国产探花免费观看_亚洲丰满少妇自慰呻吟_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教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 泰宁县| 广昌县| 铜山县| 泾川县| 龙胜| 泰来县| 汕尾市| 贡嘎县| 鹤峰县| 抚顺市| 海宁市| 河西区| 滕州市| 武威市| 淳安县| 东平县| 达孜县| 黄大仙区| 紫阳县| 侯马市| 厦门市| 绥化市| 吉隆县| 平乐县| 冷水江市| 云霄县| 阿城市| 那坡县| 桐庐县| 郎溪县| 沿河| 嘉禾县| 江油市| 高唐县| 衢州市| 卢湾区| 伊宁市| 兴业县| 龙岩市| 金昌市| 长治县|