Just like in Chapters 1 and 2, we still follow the convention in declaring the DispatcherServlet
. Using JavaConfig
, a class known as AbstractAnnotationConfigDispatcherServletInitializer
is created, to avoid declaring the servlet in a deployment descriptor.
The only difference now is that there will be separate containers catering for the JDBC configuration, DAO bean and service beans. If an XML-based ApplicationContext
is used, the deployment descriptor must implement a listener called a ContextLoaderListener
, in order to import all those ApplicationContexts
files needed by the DispatcherServlet
.
<context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/jdbc.xml /WEB-INF/dao_services.xml </param-value> </context-param> <listener> <listener-class> org.springframework.web.context...