现在的位置: 首页 > 编程语言 > 正文

springweb.xml指定配置文件过程解析

2020年02月13日 编程语言 ⁄ 共 668字 ⁄ 字号 评论关闭

这篇文章主要介绍了spring web.xml指定配置文件过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring-beans.xml</param-value></context-param>

指定多个配置文件用,隔开。

<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>

在web应用启动的,ContextLoaderListener读取contextConfigLocation中定义的xml文件,自动装配ApplicationContext的配置信息,

并产生WebApplicationContext对象,然后将这个对象放置在ServletContext的属性里,

这样我们就可以在servlet里得到WebApplicationContext(spring容器上下文)对象。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

本文标题: spring web.xml指定配置文件过程解析

以上就上有关springweb.xml指定配置文件过程解析的相关介绍,要了解更多spring,web.xml,配置,文件内容请登录学步园。

抱歉!评论已关闭.