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 ...
随机推荐
- GPP(Group Policy Preference)组策略偏好漏洞利用
总结与反思: GPP中管理员给域成员添加的账号信息存在xml,可以直接破解拿到账号密码. Windows Sever 2008 的组策略选项(GPP)是一个新引入的插件,方便管理员管理的同时也引入了安 ...
- 远程调试docker构建的weblogic
环境信息 OSType: CentOS Linux 7 (Core) x86_64 3.10.0-957.21.3.el7.x86_64 DockerVersion: 19.03.8 Mirrors: ...
- 初识socket之TCP协议
TCP服务端.客户端(基础版本) # 这是服务端import socket server = socket.socket() # 买手机server.bind(('127.0.0.1', 8080 ...
- Smallest Range II
2020-01-21 21:43:52 问题描述: 问题求解: 这个题目还是有点难度的,感觉很巧妙也很难想到. 整体的思路如下: 1. 首先原问题等价于 +0 / + 2*K 2. 那么res = M ...
- GitHub 热点速览 Vol.13:近 40k star 计算机论文项目再霸 GitHub Trending 榜
作者:HelloGitHub-小鱼干 摘要:"潮流是个轮回",这句话用来形容上周的 GitHub Trending 最贴切不过.无论是已经获得近 40k 的高星项目 Papers ...
- sql-lib闯关61-65
第六十一关 和六十关基本一样,就是变成了单引号和双括号,这好像是第一次遇见双括号 爆数据库名 ?id=1'))and extractvalue(1, concat(0x5c, (select da ...
- Rasa Stack:创建支持上下文的人工智能助理和聊天机器人教程
相关概念 Rasa Stack 是一组开放源码机器学习工具,供开发人员创建支持上下文的人工智能助理和聊天机器人: • Core = 聊天机器人框架包含基于机器学习的对话管理 • NLU = 用于自然语 ...
- 线程间交换数据的Exchanger
作者:Steven1997 链接:https://www.jianshu.com/p/9b59829fb191 来源:简书 简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处. Exc ...
- Cows POJ - 2481 (树状数组 + 单点更新 + 区间查询)
Cows 思路:我们可以按照每个范围的S从小到大排序,相同的S按E从大到小排序,这样的好处是当前范围的S一定大于等于之前范围的S(即当前的范围可能被之前范围的包围),那么我们只需要统计之前的范围E比当 ...
- [一、Jmeter5安装及环境配置]
前言:Jmeter基于Jave底层开发,需要配置Java运行时环境 第一步:首先从Jmeter的官网下载Jmeter,Oracle官网下载Jave; Apache JMeter 5.2.1(需要Jav ...