public abstract class AbstractAnnotationConfigDispatcherServletInitializer extends AbstractDispatcherServletInitializer
WebApplicationInitializer implementations that register a DispatcherServlet
configured with annotated classes, e.g. Spring's @Configuration classes.
Concrete implementations are required to implement getRootConfigClasses(),
getServletConfigClasses(), as well as AbstractDispatcherServletInitializer.getServletMappings(). Further
template and customization methods are provided by AbstractDispatcherServletInitializer.
DEFAULT_SERVLET_NAME| Constructor and Description |
|---|
AbstractAnnotationConfigDispatcherServletInitializer() |
| Modifier and Type | Method and Description |
|---|---|
protected org.springframework.web.context.WebApplicationContext |
createRootApplicationContext() |
protected org.springframework.web.context.WebApplicationContext |
createServletApplicationContext()
Create a servlet application context to be provided to the
DispatcherServlet. |
protected abstract Class<?>[] |
getRootConfigClasses()
|
protected abstract Class<?>[] |
getServletConfigClasses()
Specify
@Configuration
and/or @Component classes to be
provided to the dispatcher servlet
application context. |
customizeRegistration, getServletFilters, getServletMappings, getServletName, isAsyncSupported, onStartup, registerDispatcherServlet, registerServletFilterpublic AbstractAnnotationConfigDispatcherServletInitializer()
protected org.springframework.web.context.WebApplicationContext createRootApplicationContext()
This implementation creates an AnnotationConfigWebApplicationContext,
providing it the annotated classes returned by getRootConfigClasses().
Returns null if getRootConfigClasses() returns null.
createRootApplicationContext in class org.springframework.web.context.AbstractContextLoaderInitializerprotected org.springframework.web.context.WebApplicationContext createServletApplicationContext()
DispatcherServlet.
The returned context is delegated to Spring's
DispatcherServlet.DispatcherServlet(WebApplicationContext) As such, it
typically contains controllers, view resolvers, locale resolvers, and other
web-related beans.
This implementation creates an AnnotationConfigWebApplicationContext,
providing it the annotated classes returned by getServletConfigClasses().
createServletApplicationContext in class AbstractDispatcherServletInitializerIllegalArgumentException - if getServletConfigClasses() returns
empty or nullAbstractDispatcherServletInitializer.registerDispatcherServlet(ServletContext)protected abstract Class<?>[] getRootConfigClasses()
null
if creation and registration of a root context is not desiredprotected abstract Class<?>[] getServletConfigClasses()
@Configuration
and/or @Component classes to be
provided to the dispatcher servlet
application context.null).