在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相关推荐

  1. spring容器扩展功能之一:spring加载ApplicationContext.xml的四种方式

    容器加载Bean的常见两个类ApplicationContext和BeanFactory, 一.首先,看看spring中加载配置在xml中的Bean对象到容器 spring 中加载xml配置文件的方式 ...

  2. spring加载ApplicationContext.xml的四种方式

    spring加载ApplicationContext.xml的四种方式 spring 中加载xml配置文件的方式,好像有4种, xml是最常见的spring 应用系统配置源.Spring中的几种容器都 ...

  3. web.xml的contextConfigLocation作用及自动加载applicationContext.xml

    web.xml的contextConfigLocation作用及自动加载applicationContext.xml 转自:http://blog.csdn.net/sapphire_aling/ar ...

  4. Spring源码解析-applicationContext.xml加载和bean的注册

    applicationContext文件加载和bean注册流程 ​ Spring对于从事Java开发的boy来说,再熟悉不过了,对于我们这个牛逼的框架的介绍就不在这里复述了,Spring这个大杂烩,怎 ...

  5. Spring中加载xml配置文件的六种方式

    Spring中加载xml配置文件的六种方式 博客分类: Spring&EJB XMLSpringWebBeanBlog  因为目前正在从事一个项目,项目中一个需求就是所有的功能都是插件的形式装 ...

  6. Tomcat原理系列之四:Tomat如何启动spring(加载web.xml)

    Tomcat原理系列之四:Tomat如何启动spring 熟悉的web.xml ContextLoaderListener Tomcat的初始化StandardContext.startInterna ...

  7. Spring如何加载XSD文件(org.xml.sax.SAXParseException: Failed to read schema document错误的解决方法)...

    本文原文连接: http://blog.csdn.net/bluishglc/article/details/7596118 ,转载请注明出处! 有时候你会发现过去一直启动正常的系统,某天启动时会报出 ...

  8. org.xml.sax.SAXParseException: Failed to read schema document错误的完美解决方法 以及 Spring如何加载XSD文件

    有时候你会发现过去一直启动正常的系统,某天启动时会报出形如下面的错误: org.xml.sax.SAXParseException: schema_reference.4: Failed to rea ...

  9. spring启动加载流程

    上次看了spring的加载流程,今天发现或多都忘记了,今天又看了一下,顺便总结一下: 标题spring的web项目启动: 1.首先web容器(比如Tomcat)会读取配置在web.xml中的监听器,从 ...

最新文章

  1. 画笔Paint的使用
  2. 22. linux 常用命令
  3. 电商系统的高并发设计和挑战
  4. 信息论与编码_哈夫曼编码
  5. UA PHYS515A 电磁理论V 电磁波与辐射7 运动点电荷的辐射
  6. UIButton 的 imageEdgeInsets 和 titleEdgeInsets
  7. mongoose查找若存在,则什么都不做,若不存在,则插入
  8. Leetcode--416. 分割等和子集
  9. 【面向对象】面向对象程序设计测试题1-Java语言的发展与特性测试题
  10. 存储过程 insert
  11. File类的mkdir()与mkdirs()方法的区别
  12. Mysql中把varchar类型的字段转化为tinyint类型的字段
  13. c++primer 第2章 书上例子 资料截图等
  14. c语言串的存储操作完整,c语言中关于串的相关知识以及操作
  15. 蘑菇街基于Docker的私有云实践
  16. NPS 服务器证书:配置模板和自动注册(一)
  17. 一种免费下载专利的方法
  18. SpringCloud 微服务 (七) 服务通信 Feign
  19. warning: #61-D: integer operation result is out of range
  20. NS3网络仿真项目(三)—— Events Simulator

热门文章

  1. matlab实现三分之一倍频程,三分之一倍频程程序
  2. 前后端交互学习笔记(二):Node.js及npm学习
  3. 使用navicat进行库表数据拷贝
  4. 15K的前端应届毕业生,就因为掌握了这些知识点!(前端企业级开发必备)
  5. RRC协议学习—系统信息(SI)
  6. clion:输出中文乱码终极解决方案
  7. Barcode Producer for Mac(创建条形码软件)
  8. spring aop的术语
  9. 【数据可视化笔记】如何选择图表?
  10. STM32F4+FreeRTOS+FreeRTosTcpIp移植教程