2016-01-28 43 views
0

在spring mvc项目中,我使用纯java配置样式来配置servlet容器。是否需要在getRootConfigClasses或getServletConfigClasses中指定所有@configuration类?

AbstractAnnotationConfigDispatcherServletInitializer子类中,我重写两种方法,getRootConfigClassesgetServletConfigClasses,它们加载豆DispatcherServletContextLoaderListener分开。

是否所有@Configuration注解的类必须在任何getRootConfigClassesgetServletConfigClasses被指定,如果没有(可能),如何以及在何处被创建并存储在这些@Configuration类中定义的豆(其中应用程序上下文)?

回答

0

并非所有的配置类需要进行指定。其余的可以在根目录或web配置类

+0

感谢您的反馈,我知道使用导入可以形成一个配置链@Import版,但也间接地在这两种方法中指定。如果在根或web配置类中既没有指定也没有导入配置类会怎么样?像休眠和安全配置类? –

相关问题