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 ...
随机推荐
- php 调用curl_init失败
当你在开发微信公众号,微信小程序的时候,往往会遇到困难 进入服务器,输入 tail -f /var/log/apache2/error.log 看看apache2的日志 就因为php 的curl扩展没 ...
- Natas16 Writeup(正则匹配,php命令执行)
Natas16: 源码如下 <? $key = ""; if(array_key_exists("needle", $_REQUEST)) { $key ...
- 14. LiveBos编号自动生成
(1) var temp="Apex"; var no=""+ABS_DYNSERIALNO(true,temp); var len=no.length; va ...
- shell脚本基础-起始句的含义
大部分的shell脚本第一行,要么是 #!/bin/bash 要么是 #!/bin/sh 其实第二种是第一种的升级版,增加了协议posix(#!/bin/sh = #!/bin/bash + posi ...
- 【转载】oracle的安装和配置
转自: https://blog.csdn.net/weixin_40364885/article/details/80787472 一.概念 oracle在使用的时候时是不收费的,如果你要在工作中来 ...
- Jupyter的安装和基本使用
1. 安装Jupyter pip install jupyter 2. Jupyter的初次使用 # 进入虚拟环境 workon ai # 输入命令 jupyter notebook 本地notebo ...
- 常见排序算法总结与分析之交换排序与插入排序-C#实现
前言 每每遇到关于排序算法的问题总是不能很好的解决,对一些概念,思想以及具体实现的认识也是模棱两可.归根结底,还是掌握不够熟练.以前只是看别人写,看了就忘.现在打算自己写,写些自己的东西,做个总结.本 ...
- 关于LSTM实现长短期记忆功能问题
2019-09-07 22:01:45 问题描述:LSTM是如何实现长短期记忆功能的? 问题求解: 与传统的循环神经网络相比,LSTM仍然是基于当前输入和之前的隐状态来计算当前的隐状态,只不过对内部的 ...
- java获取不同时段
当前时间: long currentime= System.currentTimeMillis(); 本周第一天0时: Long weekstart = current.withDayOfWeek(1 ...
- 1、Spark Core所处位置和主要职责
Spark组件是基于分布式资源引擎层(Yarn等)和分布式存储层(HDFS等)之上的一个组件,Spark本质上是一个计算引擎,负责计算的,根据不同计算场景划分出了SQL.Streaming.MLib. ...