软件编程
位置:首页>> 软件编程>> java编程>> spring web.xml指定配置文件过程解析

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

作者:泡椒炒甜瓜  发布时间:2023-05-15 01:32:40 

标签:spring,web,xml,配置,文件

这篇文章主要介绍了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容器上下文)对象。

来源:https://www.cnblogs.com/chong-zuo3322/p/12259624.html

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com