自动启动Spring容器的配置
来源:互联网 发布:气象观测数据怎么画图 编辑:程序博客网 时间:2024/05/17 23:17
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
id="WebApp_ID" version="2.4">
<!--1.从类路径下加载Spring配置文件,classpath关键字特指类路径下加载--> //注意:类路径表示src目录
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<!--2.负责启动Spring容器的监听器,它将引用1处的上下文参数获得Spring配置文件地址-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
首先,通过Web容器上下文参数指定Spring配置文件的地址,如1所示。多个配置文件可用逗号或空格分隔,建议采用逗号分隔的方式。在2处指定Spring所提供的ContextLoaderListener的Web容器监听器,该监听器在web容器启动时自动运行,它会根据contextConfigLoacation Web容器参数获取Spring配置文件,并启动Spring容器。注意需要将log4j.properties日志配置文件放置在类路径下,以便日志引擎自动生效
0 0
- 自动启动Spring容器的配置
- Struts的Action自动装配到Spring 容器的配置
- Web容器启动时加载Spring的配置
- web.xml中配置启动spring容器的参数
- Spring容器的自动装配
- Spring 容器的启动方式
- spring容器 的启动过程
- Spring容器启动的第二阶段
- 通过web.xml文件自动启动spring容器加载对应的配置文件
- 流程图解Spring Framework(二) spring 如何启动容器的---XML配置
- Spring-IOC容器的配置
- Spring容器启动后自动执行Servlet进行预处理
- Spring容器启动后自动执行Servlet进行预处理
- Spring容器启动后自动执行Servlet进行预处理
- Spring容器启动后自动执行Servlet进行预处理
- Spring容器启动后自动执行Servlet进行预处理
- Spring MVC让Web容器启动时自动执行代码
- Spring揭秘 读书笔记 五 容器的启动
- hdu1556-树状数组 一维 区间更新 单点查询
- Android Studio Error:Connection timed out: connect.解决方案
- F-Cable master
- android—Actionbar
- KVM详解,太详细太深入了,经典
- 自动启动Spring容器的配置
- poj1716 Integer Intervals
- 学习:“指针数组”、“ 数组指针 ”、“函数指针”、“ 函数指针数组”、“指向函数指针数组的指针”
- removeDuplicates
- 经典软件体系结构风格(三)
- 转载:Unit Test图示
- 关于MemStore的刷新方式
- PAT 1004. Counting Leaves (30)
- hadoop--单表关联