0

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)?

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
James Hao
  • 765
  • 2
  • 11
  • 40

1 Answers1

0

Not all Configuration classes need to be specified. Remaining can be @Imported in the Root or web config class

sidgate
  • 14,650
  • 11
  • 68
  • 119
  • thanks for your feedback, I know using Import can form a config chain, but that also indirectly specified in those two methods. What if a config class neither specified nor Import ed in the root or web config classes? like hibernate and security config classes? – James Hao Jan 28 '16 at 07:47