1、web.xml中添加配置
<
web-app
>
< context-param >
< param-name >contextConfigLocation </ param-name >
< param-value >/WEB-INF/applicationContext-*.xml </ param-value >
<!-- <param-value>classpath*:applicationContext-*.xml</param-value> -->
</ context-param >
< listener >
< listener-class >org.springframework.web.context.ContextLoaderListener </ listener-class >
</ listener >
</ web-app >
< context-param >
< param-name >contextConfigLocation </ param-name >
< param-value >/WEB-INF/applicationContext-*.xml </ param-value >
<!-- <param-value>classpath*:applicationContext-*.xml</param-value> -->
</ context-param >
< listener >
< listener-class >org.springframework.web.context.ContextLoaderListener </ listener-class >
</ listener >
</ web-app >
2、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 >
< 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 >
3、在(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 >
< set-property property ="contextConfigLocation"
value ="/WEB-INF/applicationContext.xml,
/WEB-INF/action-servlet.xml" />
</ plug-in >