国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > Java > 正文

web容器中實例化spring相關配置解析

2024-07-13 10:16:21
字體:
來源:轉載
供稿:網友

文章主要探究了web容器中實例化spring的相關配置簡單介紹,接下來我們看看具體內容。

web容器中實例化spring相關配置說明:

要想在web容器實例化時加載spring容器,web.xml文件中配置如下:

<context-param>  <param-name>contextConfigLocation</param-name>  <param-value>classpath:bean.xml</param-value></context-param><!-- 對Spring容器進行實例化的監聽器s --><listener>   <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>

說明:

默認情況下spring實例化時加載的是/WEB-INF/下的applicationContext.xml

<param-name>contextConfigLocation</param-name>

<param-value>classpath:bean.xml</param-value>指定了spring需要加載的文件(類路徑下的bean.xml文件)

如果配置文件有多個配置如下:

  <context-param>    <param-name>contextConfigLocation</param-name>    <param-value>      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    </param-value>  </context-param>

或者(使用空格隔開,如下配置:)

     <CONTEXT-PARAM>     <PARAM-NAME>contextConfigLocation</PARAM-NAME>     <PARAM-VALUE>        applicationContext-database.xml applicationContext.xml     </PARAM-VALUE>    </CONTEXT-PARAM>

總結

以上就是本文關于web容器中實例化spring相關配置解析的全部內容,希望對大家有所幫助.


注:相關教程知識閱讀請移步到JAVA教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 临桂县| 廉江市| 阜城县| 柳江县| 沂水县| 肥乡县| 武隆县| 陵川县| 临海市| 岳阳市| 福清市| 上饶市| 阳曲县| 荔浦县| 吴桥县| 巧家县| 麻城市| 兰坪| 浦城县| 沅陵县| 屯昌县| 永清县| 唐山市| 阳曲县| 喀什市| 于田县| 江油市| 永平县| 留坝县| 峨眉山市| 霍城县| 通山县| 曲麻莱县| 成武县| 丰宁| 松江区| 德化县| 德化县| 汉沽区| 麟游县| 仁怀市|