|
32 | 32 | import org.springframework.web.context.AbstractContextLoaderInitializer;
|
33 | 33 | import org.springframework.web.context.WebApplicationContext;
|
34 | 34 | import org.springframework.web.servlet.DispatcherServlet;
|
| 35 | +import org.springframework.web.servlet.FrameworkServlet; |
35 | 36 |
|
36 | 37 | /**
|
37 | 38 | * Base class for {@link org.springframework.web.WebApplicationInitializer}
|
@@ -90,7 +91,7 @@ protected void registerDispatcherServlet(ServletContext servletContext) {
|
90 | 91 | "createServletApplicationContext() did not return an application " +
|
91 | 92 | "context for servlet [" + servletName + "]");
|
92 | 93 |
|
93 |
| - DispatcherServlet dispatcherServlet = createDispatcherServlet(servletAppContext); |
| 94 | + FrameworkServlet dispatcherServlet = createDispatcherServlet(servletAppContext); |
94 | 95 | dispatcherServlet.setContextInitializers(getServletApplicationContextInitializers());
|
95 | 96 |
|
96 | 97 | ServletRegistration.Dynamic registration = servletContext.addServlet(servletName, dispatcherServlet);
|
@@ -132,9 +133,12 @@ protected String getServletName() {
|
132 | 133 | protected abstract WebApplicationContext createServletApplicationContext();
|
133 | 134 |
|
134 | 135 | /**
|
135 |
| - * Create a {@link DispatcherServlet} with the specified {@link WebApplicationContext}. |
| 136 | + * Create a {@link DispatcherServlet} (or other kind of {@link FrameworkServlet}-derived |
| 137 | + * dispatcher) with the specified {@link WebApplicationContext}. |
| 138 | + * <p>Note: This allows for any {@link FrameworkServlet} subclass as of 4.2.3. |
| 139 | + * Previously, it insisted on returning a {@link DispatcherServlet} or subclass thereof. |
136 | 140 | */
|
137 |
| - protected DispatcherServlet createDispatcherServlet(WebApplicationContext servletAppContext) { |
| 141 | + protected FrameworkServlet createDispatcherServlet(WebApplicationContext servletAppContext) { |
138 | 142 | return new DispatcherServlet(servletAppContext);
|
139 | 143 | }
|
140 | 144 |
|
|
0 commit comments