In spring mvc project, I use purely java config style to configure the servlet container.
In a AbstractAnnotationConfigDispatcherServletInitializer
subclass, I override two methods, getRootConfigClasses
and getServletConfigClasses
, they load beans for DispatcherServlet
and ContextLoaderListener
separately.
Do all @Configuration
annotated classes need to be specified in either getRootConfigClasses
or getServletConfigClasses
, if no (probably), how and where the beans defined in those @Configuration
classes are created and stored (in which application context)?
Not all Configuration classes need to be specified. Remaining can be @Import
ed in the Root or web config class