1、在web.xml中加载:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>**/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
2、在struts-config.xml中加载:
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="**/applicationContext.xml" />
</plug-in>
本文介绍了两种在Web应用程序中加载Spring应用上下文的方法:一种是在web.xml中使用ContextLoaderListener,另一种是在struts-config.xml中使用ContextLoaderPlugIn。这两种方式都可以指定applicationContext.xml的位置。

166

被折叠的 条评论
为什么被折叠?



