首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

配置文件加载Spring配置文件步骤

2012-07-25 
配置文件加载Spring配置文件方法方法一:(web.xml)web-app?? context-param????? param-namecontextC

配置文件加载Spring配置文件方法

方法一:(web.xml)
<web-app>
?? <context-param>
????? <param-name>contextConfigLocation</param-name>
????? <param-value>/WEB-INF/applicationContext-*.xml</param-value>
?? </context-param>
<listener>
??? <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
?</listener>
</web-app>


方法二(web.xml)
<web-app>
?? <context-param>
????? <param-name>contextConfigLocation</param-name>
????? <param-value>/WEB-INF/applicationContext-*.xml</param-value>
?? </context-param>
?? <servlet>
????? <servlet-name>SpringContextServlet</servlet-name>
????? <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
????? <load-on-startup>1</load-on-startup>
?? </servlet>
</web-app>


方法三(struts-config.xml)
?<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
??????? <set-property property="contextConfigLocation"
??????????? value="/WEB-INF/applicationContext.xml,/WEB-INF/action-servlet.xml"/>
?</plug-in>

?

?

热点排行