spring有三种启动方式,使用ContextLoaderServlet,ContextLoaderListener和ContextLoaderPlugIn
spring3.0及以后版本中已经删除ContextLoaderServlet 和Log4jConfigServlet
可以采用余下两种启动方式ContextLoaderListener和ContextLoaderPlugIn
建议使用ContextLoaderListener

N0:1 <!--推荐使用此种方式-->  <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>
N0:2
<!--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>--> N0:3
<!--要导入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有三种启动方式的更多相关文章

  1. spring boot 启动方式

    一:IDE 运行Application这个类的main方法 二:在springboot的应用的根目录下运行mvn spring-boot:run 三:使用mvn install 生成jar后运行 先到 ...

  2. spring启动方式

    spring有三种启动方式,使用ContextLoaderServlet,ContextLoaderListener和ContextLoaderPlugIn.看一下ContextLoaderListe ...

  3. spring容器启动的三种方式

    一.在Web项目中,启动Spring容器的方式有三种,ContextLoaderListener.ContextLoadServlet.ContextLoaderPlugin. 1.1.监听器方式: ...

  4. spring boot-- 三种启动方式

    spring-boot的三种启动方式 1. 直接运行SpringbootApplication.java 2.在项目目录下运行mvn spring-boot:run 3.先编译项目mvn instal ...

  5. Spring Boot 项目几种启动方式

    Spring Boot 项目几种启动方式 1. 使用 main 启动 jar xxxx.jar 2. 使用 mvn 启动 mvn spring-boot:run 3. 使用 Spring Boot c ...

  6. SpringBoot启动方式,Spring Boot 定义系统启动任务

    SpringBoot启动方式,Spring Boot 定义系统启动任务 SpringBoot启动方式 1.1 方法一 1.2 方法二 1.2.1 start.sh 1.2.2 stop.sh 1.2. ...

  7. spring-boot的三种启动方式[z]

    https://blog.csdn.net/u011425751/article/details/79507386 有段时间没有写博客了,也在努力的从传统单机开发向分布式系统过度,所以再次做一些笔记, ...

  8. Spring Boot 启动(二) Environment 加载

    Spring Boot 启动(二) Environment 加载 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) 上一节中 ...

  9. Spring基于XML方式的使用

    一.IoC配置 IoC的配置是通过Spring的xml文件的bean标签进行的. 1.bean标签介绍 bean标签一般是在xml文件进行配置的,xml文件一般样式如下: <?xml versi ...

随机推荐

  1. http://www.mysqltutorial.org/python-mysql-query/

    This tutorial shows you how to query data from a MySQL database in Python by using MySQL Connector/P ...

  2. Oracle 数据库基础学习 (七) SQL语句综合练习

    一.多表查询综合练习 1.  列出高于在30部门工作的所有人员的薪金的员工的姓名.部门名称.部门编号.部门人数 分析: 需要的员工信息: |-emp表:姓名.部门编号 |-dept表:部门名称.部门编 ...

  3. WPF 数据绑定 1_1 基础知识&绑定到元素属性

    A.数据绑定基础: 数据源对象:WPF将从该对象中提取信息,交由目标对象进行显示. 目标对象:从数据源中提取信息,并赋给该对象的属性. B.绑定到元素属性 最简单的绑定情形则是将一个源对象指定为一个W ...

  4. [deviceone开发]-一个固定列,可以上下左右滑动的表格示例

    一.简介 一个类型table的例子,第一列和第二列可以固定,剩下的后面的很多列都可以左右滑动,也可以上下滑动,这种需求一般是为了展示多列表格数据.这个例子是通过二大部分: 左边是一个普通的listvi ...

  5. 独立IP 与 共享IP

    最近在阿里云产品体系中折腾的不亦乐乎,在选则服务器的时候,会有独立IP和共享IP的两种不同的选择,这里查阅资料予以记录,独立IP与共享IP的区别: 因为IP资源有限,独立IP就是说一个IP地址只给你一 ...

  6. 纯HTML5+CSS3制作生日蛋糕

    以一个前端开发的身份绘制一个简单的蛋糕庆祝一下今天这个好日子吧,程序员庆生的乐趣与哀愁啊.写的比较简陋,感兴趣的看一下吧. 先发个效果图吧 蛋糕分为三个部分,底部蛋糕,顶层蛋糕和蜡烛部分.HTML的布 ...

  7. Android Json处理框架

    1.Android 中的Json解析工具fastjson .序列化.反序列化 2.Android Gson的使用总结 3.Android-JSONTool 一个简易的Json框架类,小到只有一个类 有 ...

  8. ButterKnife 8.2.1 大圣归来

    零.前言 ButterKnife是一个视图注入的框架,主要帮我们解决无脑的findViewById.设置监听事件等等体力劳动. 一.引入 好消息是ButterKnife终于使用apt生成代码了,首先在 ...

  9. JDBC快速入门

    /** * JDBC快速入门: * 1.导入jar包 数据库驱动 * 2.注册驱动 * 3.获取数据库连接对象 Connection * 4.定义sql语句 * 5.获取发送执行sql语句的对象 St ...

  10. 利用split

    java.lang.string.splitsplit 方法将一个字符串分割为子字符串,然后将结果作为字符串数组返回.stringObj.split([separator,[limit]])strin ...