spring有三种启动方式
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有三种启动方式的更多相关文章
- spring boot 启动方式
一:IDE 运行Application这个类的main方法 二:在springboot的应用的根目录下运行mvn spring-boot:run 三:使用mvn install 生成jar后运行 先到 ...
- spring启动方式
spring有三种启动方式,使用ContextLoaderServlet,ContextLoaderListener和ContextLoaderPlugIn.看一下ContextLoaderListe ...
- spring容器启动的三种方式
一.在Web项目中,启动Spring容器的方式有三种,ContextLoaderListener.ContextLoadServlet.ContextLoaderPlugin. 1.1.监听器方式: ...
- spring boot-- 三种启动方式
spring-boot的三种启动方式 1. 直接运行SpringbootApplication.java 2.在项目目录下运行mvn spring-boot:run 3.先编译项目mvn instal ...
- Spring Boot 项目几种启动方式
Spring Boot 项目几种启动方式 1. 使用 main 启动 jar xxxx.jar 2. 使用 mvn 启动 mvn spring-boot:run 3. 使用 Spring Boot c ...
- SpringBoot启动方式,Spring Boot 定义系统启动任务
SpringBoot启动方式,Spring Boot 定义系统启动任务 SpringBoot启动方式 1.1 方法一 1.2 方法二 1.2.1 start.sh 1.2.2 stop.sh 1.2. ...
- spring-boot的三种启动方式[z]
https://blog.csdn.net/u011425751/article/details/79507386 有段时间没有写博客了,也在努力的从传统单机开发向分布式系统过度,所以再次做一些笔记, ...
- Spring Boot 启动(二) Environment 加载
Spring Boot 启动(二) Environment 加载 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) 上一节中 ...
- Spring基于XML方式的使用
一.IoC配置 IoC的配置是通过Spring的xml文件的bean标签进行的. 1.bean标签介绍 bean标签一般是在xml文件进行配置的,xml文件一般样式如下: <?xml versi ...
随机推荐
- Lind.DDD.Utils.HttpHelper关于对HttpClient的正确使用
回到目录 官方的不一定是对的,机器最能证明一切 不知道从什么时候起,我们在写数据库连接,网络连接,文件操作时会习惯加上using,这种习惯被我们误称为一种模式,但事实上,一切事情都有因有果的,使用us ...
- 美女jquery图片播放器插件
相册在线查看http://keleyi.com/keleyi/phtml/image/6.htm 可全屏,可拖动,可自动播放的jquery图片展示插件 使用说明:1.引用css文件:<link ...
- MySQL中进行模糊搜索的一些问题
在搜索数据库中的数据时,SQL 通配符可以替代一个或多个字符.SQL 通配符必须与 LIKE 运算符一起使用.在 SQL 中,可使用以下通配符:通配符 描述 % 替代一个或多个字符 ...
- JQ中的方法、事件及动画
css( ) 除了可以为元素添加样式外,还可用来查询元素,某样式值alert($('.cls1').css('width')); //100px(返回带单位的值)注意:原生CSS样式中有-的去掉并且将 ...
- IIS6.0添加上.net4.0后,以前的.net系统出现“服务器应用程序不可用”的错误提示解决办法
把VS2010开发的网站.net4.0部署到Windows Server 2003的服务器上去, Windows Server 2003操作系统自带的为IIS 6.0,IIS 6.0一般只支持.NET ...
- JavaScript 变量声明提前
<JavaScript权威指南>中指出:JavaScript变量在声明之前已经可用,JavaScript的这个特性被非正式的称为声明提前(hoisting),即JavaScript函数中声 ...
- .html(),.text()和.val()的差异总结
.html(),.text(),.val()三种方法都是用来读取选定元素的内容:只不过.html()是用来读取元素的html内容(包括html标签),.text()用来读取元素的纯文本内容,包括其后代 ...
- iOS开发UI篇—UITabBarController简单介绍
iOS开发UI篇—UITabBarController简单介绍 一.简单介绍 UITabBarController和UINavigationController类似,UITabBarControlle ...
- NSLog 占位符
转自:http://blog.sina.com.cn/s/blog_75f190280101dmj8.html [iOS]Objective-C占位符使用 (2013-10-21 10:24:16) ...
- IE10 和 Chrome50 对日期 new Date() 支持的区别
IE10 和 Chrome50 对日期 new Date() 支持的区别: new Date('2016-06-18'); // IE10 不通过.Chrome 通过 new Date('2016/0 ...