spring 如何加载applicationContext.xml
在web.xml中配置spring
NO1.推荐使用
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!--contextConfigLocation在 ContextLoaderListener类中的默认值是 /WEB-INF/applicationContext.xml-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
<!-- <param-value>classpath:applicationContext*.xml</param-value> -->
</context-param>
Classpath指代的就是 web-inf/classes/ 目录
NO2.
<!--spring3.0之后不再支持此种方式-->
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
NO3.
<!--要导入org.springframework.web.struts-3.0.5.RELEASE.jar包,在struts2.0及以后版本不支持此种方式加载spring-->
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml"/>
</plug-in>
spring 如何加载applicationContext.xml相关推荐
- spring容器扩展功能之一:spring加载ApplicationContext.xml的四种方式
容器加载Bean的常见两个类ApplicationContext和BeanFactory, 一.首先,看看spring中加载配置在xml中的Bean对象到容器 spring 中加载xml配置文件的方式 ...
- spring加载ApplicationContext.xml的四种方式
spring加载ApplicationContext.xml的四种方式 spring 中加载xml配置文件的方式,好像有4种, xml是最常见的spring 应用系统配置源.Spring中的几种容器都 ...
- web.xml的contextConfigLocation作用及自动加载applicationContext.xml
web.xml的contextConfigLocation作用及自动加载applicationContext.xml 转自:http://blog.csdn.net/sapphire_aling/ar ...
- Spring源码解析-applicationContext.xml加载和bean的注册
applicationContext文件加载和bean注册流程 Spring对于从事Java开发的boy来说,再熟悉不过了,对于我们这个牛逼的框架的介绍就不在这里复述了,Spring这个大杂烩,怎 ...
- Spring中加载xml配置文件的六种方式
Spring中加载xml配置文件的六种方式 博客分类: Spring&EJB XMLSpringWebBeanBlog 因为目前正在从事一个项目,项目中一个需求就是所有的功能都是插件的形式装 ...
- Tomcat原理系列之四:Tomat如何启动spring(加载web.xml)
Tomcat原理系列之四:Tomat如何启动spring 熟悉的web.xml ContextLoaderListener Tomcat的初始化StandardContext.startInterna ...
- Spring如何加载XSD文件(org.xml.sax.SAXParseException: Failed to read schema document错误的解决方法)...
本文原文连接: http://blog.csdn.net/bluishglc/article/details/7596118 ,转载请注明出处! 有时候你会发现过去一直启动正常的系统,某天启动时会报出 ...
- org.xml.sax.SAXParseException: Failed to read schema document错误的完美解决方法 以及 Spring如何加载XSD文件
有时候你会发现过去一直启动正常的系统,某天启动时会报出形如下面的错误: org.xml.sax.SAXParseException: schema_reference.4: Failed to rea ...
- spring启动加载流程
上次看了spring的加载流程,今天发现或多都忘记了,今天又看了一下,顺便总结一下: 标题spring的web项目启动: 1.首先web容器(比如Tomcat)会读取配置在web.xml中的监听器,从 ...
最新文章
- 画笔Paint的使用
- 22. linux 常用命令
- 电商系统的高并发设计和挑战
- 信息论与编码_哈夫曼编码
- UA PHYS515A 电磁理论V 电磁波与辐射7 运动点电荷的辐射
- UIButton 的 imageEdgeInsets 和 titleEdgeInsets
- mongoose查找若存在,则什么都不做,若不存在,则插入
- Leetcode--416. 分割等和子集
- 【面向对象】面向对象程序设计测试题1-Java语言的发展与特性测试题
- 存储过程 insert
- File类的mkdir()与mkdirs()方法的区别
- Mysql中把varchar类型的字段转化为tinyint类型的字段
- c++primer 第2章 书上例子 资料截图等
- c语言串的存储操作完整,c语言中关于串的相关知识以及操作
- 蘑菇街基于Docker的私有云实践
- NPS 服务器证书:配置模板和自动注册(一)
- 一种免费下载专利的方法
- SpringCloud 微服务 (七) 服务通信 Feign
- warning: #61-D: integer operation result is out of range
- NS3网络仿真项目(三)—— Events Simulator