Skip to content

Commit 4534c5f

Browse files
committed
AbstractReactiveWebInitializer supports Servlet mapping
Issue: SPR-16155, SPR-16144
1 parent 8c33ed0 commit 4534c5f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

spring-web/src/main/java/org/springframework/web/server/adapter/AbstractReactiveWebInitializer.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void onStartup(ServletContext servletContext) throws ServletException {
6262
Assert.notNull(registration, "Failed to register servlet '" + servletName + "'.");
6363

6464
registration.setLoadOnStartup(1);
65-
registration.addMapping("/");
65+
registration.addMapping(getServletMapping());
6666
registration.setAsyncSupported(true);
6767
}
6868

@@ -93,4 +93,13 @@ protected ApplicationContext createApplicationContext() {
9393
*/
9494
protected abstract Class<?>[] getConfigClasses();
9595

96+
/**
97+
* Return the Servlet mapping to use. Only the default Servlet mapping '/'
98+
* and path-based Servlet mappings such as '/api/*' are supported.
99+
* <p>By default this is set to '/'.
100+
*/
101+
protected String getServletMapping() {
102+
return "/";
103+
}
104+
96105
}

0 commit comments

Comments
 (0)