public abstract class AbstractAnnotationConfigDispatcherHandlerInitializer extends AbstractDispatcherHandlerInitializer
WebApplicationInitializer
to register a DispatcherHandler
, wrapping it in a
ServletHttpHandlerAdapter
, and use Java-based Spring configuration.
Concrete implementations are required to implement getConfigClasses()
.
Further template and customization methods are provided by
AbstractDispatcherHandlerInitializer
.
DEFAULT_SERVLET_MAPPING, DEFAULT_SERVLET_NAME
Constructor and Description |
---|
AbstractAnnotationConfigDispatcherHandlerInitializer() |
Modifier and Type | Method and Description |
---|---|
protected ApplicationContext |
createApplicationContext()
Create an application context to be provided to the
DispatcherHandler . |
protected abstract java.lang.Class<?>[] |
getConfigClasses()
|
createDispatcherHandler, createHandlerAdapter, customizeRegistration, getServletMapping, getServletName, onStartup, refreshApplicationContext, registerCloseListener, registerDispatcherHandler
public AbstractAnnotationConfigDispatcherHandlerInitializer()
protected ApplicationContext createApplicationContext()
DispatcherHandler
.
The returned context is delegated to Spring's
DispatcherHandler.DispatcherHandler(ApplicationContext)
. As such,
it typically contains controllers, view resolvers, and other web-related beans.
This implementation creates an AnnotationConfigApplicationContext
,
providing it the annotated classes returned by getConfigClasses()
.
createApplicationContext
in class AbstractDispatcherHandlerInitializer
AbstractDispatcherHandlerInitializer.registerDispatcherHandler(ServletContext)
protected abstract java.lang.Class<?>[] getConfigClasses()