ContextLoader.configureAndRefres

2018-12-12  本文已影响0人  赫灵

1、设置ConfigLocation

读取web.xml里面的配置参数:contextConfigLocation

如果没有这个参数,则使用/WEB-INF/applicationContext.xml

2、customizeContext

2.1、如果想在WebApplicationContext.refresh之前实例化一些类,那么可以让这些类实现ApplicationContextInitializer接口,然后配置在web.xml的下面的属性里面,这样在refresh之前就会先实例化这些类,并且可以使用spring的Order 标签进行优先级设置:

读取web.xml里面的配置参数:globalInitializerClasses

读取web.xml里面的配置参数:contextInitializerClasses

3、WebApplicationContext.refresh

上一篇 下一篇

猜你喜欢

热点阅读