web.xml中通过contextConfigLocation的读取spring的配置文件
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classpath:/db-pub.xml,
- classpath:db-edu.xml,
- classpath:bean*.xml,
- classpath*:timer-system.xml
- </param-value>
- </context-param>
注意:部署程序启动tomcat之后,log4j显示出 [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [db-pub.xml] [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [db-edu.xml] [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [E:\apache-tomcat-6.0.33-windows-x86\apache-tomcat-6.0.33\webapps\DigitalCampus\WEB-INF\classes\bean-edu.xml] [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [E:\apache-tomcat-6.0.33-windows-x86\apache-tomcat-6.0.33\webapps\DigitalCampus\WEB-INF\classes\bean-pub.xml] [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from URL [file:/E:/apache-tomcat-6.0.33-windows-x86/apache-tomcat-6.0.33/webapps/DigitalCampus/WEB-INF/classes/timer-system.xml]
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classpath:/db-pub.xml,
- classpath:db-edu.xml,
- classpath*:bean*.xml,
- /WEB-INF/classes/timer-system.xml
- <!-- classpath*:timer-system.xml-->
- </param-value>
- </context-param>
[main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [db-pub.xml] [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [db-edu.xml] [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [E:\apache-tomcat-6.0.33-windows-x86\apache-tomcat-6.0.33\webapps\DigitalCampus\WEB-INF\classes\bean-edu.xml] [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [E:\apache-tomcat-6.0.33-windows-x86\apache-tomcat-6.0.33\webapps\DigitalCampus\WEB-INF\classes\bean-pub.xml] [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/timer-system.xml]
根据以上两个例子: 1 classpath和classpath*的区别是:前者from class path resource,后者from URL。classpath:只会到你的class路径中查找找文件; classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找. 2 带不带有/,没有区别。 3 bean*.xml查找的是以bean开头的配置文件,from file 4 classpath*:bean*.xml 为from file. 5 /WEB-INF/classes/timer-system.xml 为from ServletContext resource。
另外: "**/" 表示的是任意目录; "**/applicationContext-*.xml" 表示任意目录下的以"applicationContext-"开头的XML文件。 程序部署到tomcat后,src目录下的配置文件会和class文件一样,自动copy到应用的 WEB-INF/classes目录下
web.xml中通过contextConfigLocation的读取spring的配置文件的更多相关文章
- 【转】web.xml中的contextConfigLocation在spring中的作用
一.spring中如何使用多个xml配置文件 1.在web.xml中定义contextConfigLocation参数,Spring会使用这个参数去加载所有逗号分隔的xml文件,如果没有这个参数,sp ...
- (转)web.xml中的contextConfigLocation在spring中的作用
(转)web.xml中的contextConfigLocation在spring中的作用 一.Spring如何使用多个xml配置文件 1.在web.xml中定义contextConfigLocat ...
- web.xml中的contextConfigLocation在spring中的作用
在web.xml中通过contextConfigLocation配置spring, contextConfigLocation参数定义了要装入的 Spring 配置文件.默认会去/WEB-INF/下加 ...
- web.xml中的contextConfigLocation的作用
在web.xml中通过contextConfigLocation配置spring,contextConfigLocation 参数定义了要装入的 Spring 配置文件. 如果想装入多个配置文件,可以 ...
- 在web.xml中通过contextConfigLocation配置spring
<context-param> <param-name>contextConfigLocation</param-name> < ...
- web.xml中contextConfigLocation的作用(转)
原文地址:http://blog.csdn.net/zhangliao613/article/details/6289114 原文格式较乱,此处略作整理.内容未变. 在web.xml中使用contex ...
- spring 和springmvc 在 web.xml中的配置
(1)问题:如何在Web项目中配置Spring的IoC容器? 答:如果需要在Web项目中使用Spring的IoC容器,可以在Web项目配置文件web.xml中做出如下配置: <!-- Sprin ...
- 使用Spring时web.xml中的配置
使用Spring时web.xml中的配置: <?xml version="1.0" encoding="UTF-8"?> <web-app x ...
- web.xml中配置Spring中applicationContext.xml的方式
2011-11-08 16:29 web.xml中配置Spring中applicationContext.xml的方式 使用web.xml方式加载Spring时,获取Spring applicatio ...
随机推荐
- Mol Cell Proteomics. | Elevated Hexokinase II Expression Confers Acquired Resistance to 4-Hydroxytamoxifen in Breast Cancer Cells(升高的己糖激酶II表达使得乳腺癌细胞获得对他莫昔芬的抗性)(解读人:黄旭蕾)
文献名:Elevated Hexokinase II Expression Confers Acquired Resistance to 4-Hydroxytamoxifen in Breast Ca ...
- docker:一文学基础使用
目录 docker介绍 安装与镜像源配置 CentOS7 安装 设置镜像源 补充: 简单使用例子 基础概念 四个概念 镜像概念补充: 容器概念补充: 常用命令: 查看docker信息 镜像操作 容器操 ...
- CTF_WriteUp_HTTP——302临时重定向问题
HTTP--302临时重定向 题目描述 点击给出的链接后,没有发生任何变化. 解决方案 通过擦好看网络请求,可以发现发生了302临时跳转,所以我们无法通过浏览器直接访问未跳转的页面,而flag 可能藏 ...
- scapy学习笔记
1.ACK Scan >>>ans,unans=sr(IP(dst="www.baidu.com")/TCP(dport=[80,666],flags=" ...
- 朴素贝叶斯分类器(Naive Bayesian Classifier)
本博客是基于对周志华教授所著的<机器学习>的"第7章 贝叶斯分类器"部分内容的学习笔记. 朴素贝叶斯分类器,顾名思义,是一种分类算法,且借助了贝叶斯定理.另外,它是一种 ...
- c++第一个程序测试-----c++每日笔记!
#include <iostream>int main(){ //std::cout << "Enter two number:" <<std: ...
- spring @EnableAspectJAutoProxy背后的那些事(spring AOP源码赏析)
在这个注解比较流行的年代里,当我们想要使用spring 的某些功能时只需要加上一行代码就可以了,比如: @EnableAspectJAutoProxy开启AOP, @EnableTransaction ...
- mabatis入门五 高级结果映射
一.创建测试的表和数据 1.创建表 1CREATE TABLE items ( 2 id INT NOT NULL AUTO_INCREMENT, 3 itemsname VARCHAR(32) NO ...
- HBase Shell Get 操作常用小技巧
在工作中,有时候只是想简单看下HBase表某些关键指标的值,这个时候总不能现写Java代码去查看,以下几个小技巧你可能会经常用到. 1. 某行有许多列,只想获取指定2~3列的数据 hbase> ...
- jdk下httpserver源码解析
在写这篇博客之前我查了很久发现全网都没有一篇写httpserver源码解析的 所以今天就由我来为大家解析一下httpserver的源码.(这里我会去掉其中的https部分的源码,只讲http部分,对h ...