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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

泡椒炒甜瓜   2021-04-02 我要评论

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

您可能感兴趣的文章:

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们