這篇文章主要介紹web容器中實(shí)例化spring相關(guān)配置的示例分析,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
web容器中實(shí)例化spring相關(guān)配置說(shuō)明:
要想在web容器實(shí)例化時(shí)加載spring容器,web.xml文件中配置如下:
contextConfigLocation classpath:bean.xml org.springframework.web.context.ContextLoaderListener
說(shuō)明:
默認(rèn)情況下spring實(shí)例化時(shí)加載的是/WEB-INF/下的applicationContext.xml
如果配置文件有多個(gè)配置如下:
contextConfigLocation classpath*:conf/spring/applicationContext_core*.xml, classpath*:conf/spring/applicationContext_dict*.xml, classpath*:conf/spring/applicationContext_hibernate.xml, classpath*:conf/spring/applicationContext_staff*.xml, classpath*:conf/spring/applicationContext_security.xml classpath*:conf/spring/applicationContext_modules*.xml classpath*:conf/spring/applicationContext_cti*.xml classpath*:conf/spring/applicationContext_apm*.xml
或者(使用空格隔開(kāi),如下配置:)
contextConfigLocation applicationContext-database.xml applicationContext.xml
以上是“web容器中實(shí)例化spring相關(guān)配置的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!