加载spring配置文件的常用三种方法
2008-03-18 15:14
716 查看
1方法(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>
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>
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>
<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>
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>
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>
相关文章推荐
- 加载spring配置文件的常用三种方法
- 加载spring配置文件的常用三种方法
- 加载Spring配置文件常用的三种方法
- 加载spring配置文件的常用三种方法
- 加载spring配置文件的常用三种方法
- 在Sping的配置文件中,关于dataSource的配置,就我们常用的方法大致可以有三种:
- Spring配置文件的三种方法(创建测试类Test.java)
- spring 实例化定义在xml配置文件中的bean的三种方法?
- Spring中加载XML配置文件的方法
- SSH学习九 依赖注入及加载Spring配置文件的方法
- Spring (一) 加载配置文件,实例化类, 三种实例化bean的方式
- Spring加载配置文件的三种方式
- 【log4j2 加载配置文件】 加载配置文件的三种方法
- Spring加载配置文件的几种方法
- 在Maven项目中加载spring中的bean的配置xml文件会提示找不到解决方法
- Spring加载配置文件的三种方式
- spring加载一个或者多个properties配置文件方法
- Struts2的配置文件加载顺序及常用常量名及更改方法、注意事项
- java一般加载配置文件时常用的方法
- 加载spring配置文件的三种方式