spring配置文件中context:property-placeholder导入多个独立的配置文件
spring中 context:property-placeholder 导入多个独立的 .properties配置文件?
Spring容器采用反射扫描的发现机制,在探测到Spring容器中有一个 org.springframework.beans.factory.config.PropertyPlaceholderConfigurer的 Bean就会停止对剩余PropertyPlaceholderConfigurer的扫描(Spring 3.1已经使用PropertySourcesPlaceholderConfigurer替代 PropertyPlaceholderConfigurer了)。
换句话说,即Spring容器仅允许最多定义一个PropertyPlaceholderConfigurer(或<context:property-placeholder/>),其余的会被Spring忽略掉(其实Spring如果提供一个警告就好了)。
举个例子,applicationContext.xml文件中需要导入jdbc.properties和redis.properties两个配置文件,
那这样写是不行的,只能识别到jdbc.properties
<context:property-placeholder location="classpath:jdbc.properties" />
<context:property-placeholder location="classpath:redis.properties" />
咋解决呢?
通配符解决
<context:property-placeholder location="classpath*:conf/conf*.properties"/>
spring配置文件中context:property-placeholder导入多个独立的配置文件的更多相关文章
- Spring框架中Spring配置文件中<context:annotation-config/>标签说明
<context:annotation-config/>此标签的重要作用就是: 省去系统繁琐的注解标签,加上一个此标签,就可以在此项目程序添加“注解”的功能,使系统识别相应的注解功能!! ...
- Spring 梳理-使用<context:property-placeholder>标签导入多个properties文件
使用<context:property-placeholder>标签导入多个properties文件 2017年12月20日 10:10:36 sf_climber 阅读数:5830更多 ...
- Spring配置中<context:annotation-config> VS <context:component-scan>
Spring 中在使用注解(Annotation)会涉及到< context:annotation-config> 和 < context:component-scan>配置, ...
- Spring Boot中的微信支付(小程序)
前言 微信支付是企业级项目中经常使用到的功能,作为后端开发人员,完整地掌握该技术是十分有必要的. logo 一.申请流程和步骤 图1-1 注册微信支付账号 获取微信小程序APPID 获取微信商家的商户 ...
- 【Spring】Spring bean中id和name的差异
id和name都是spring 容器中中bean 的唯一标识符. id: 一个bean的唯一标识 , 命名格式必须符合XML ID属性的命名规范 name: 可以用特殊字符,并且一个bean可以用多个 ...
- OpenVPN客户端证书合并到配置文件中
这里只讲OpenVPN客户端证书合并到配置文件中,避免文件太多,管理不便! 生成的客户端证书和配置文件,客户端需要的一共有5个文件:ca.crt.client.crt.client.key.ta.ke ...
- 如果使用jsp文件,需要在配置文件中配置resources项,才能让idea识别这个jsp文件
没有添加这一项在编译后的.class文件中的结构目录是这样子的 添加上这一个配置项,在class配置文件中的位置是这样子的: 添加的配置文件是这样子的: <resources> <r ...
- spring中 context:property-placeholder 导入多个独立的 .properties配置文件
spring中 context:property-placeholder 导入多个独立的 .properties配置文件? Spring容器采用反射扫描的发现机制,在探测到Spring容器中有一个 o ...
- Spring中 <context:property-placeholder 的使用与解析 .properties 配置文件的加载
转: Spring中property-placeholder的使用与解析 Spring中property-placeholder的使用与解析 我们在基于spring开发应用的时候,一般都会将数据库的配 ...
随机推荐
- android混淆和反编译
混淆 Android Studio: 只需在build.gradle(Module:app)中的buildTypes中增加release的编译选项即可,如下: <code class=&quo ...
- kettle文件自动化部署(shell脚本执行):命令行参数传入
shell脚本中调用kitchen 和 pan去执行,job和transformation文件.分 windows和 dos系统两种. 举个简单的小例子 shell脚本: export JAVA_HO ...
- Make3D Convert your image into 3d model
Compiling and Running Make3D on your own computer source: http://make3d.cs.cornell.edu/code_linux.ht ...
- Leetcode_217_Contains Duplicate
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/46271159 Given an array of inte ...
- Linux - crontab的创建以及注意事项
[root@www ~]# crontab [-u username] [-l|-e|-r] 选项与参数: -u :只有 root 才能进行这个任务,亦即帮其他使用者创建/移除 crontab 工作排 ...
- Redis配置信息
# Redis configuration file example # Note on units: when memory size is needed, it is possible to sp ...
- CentOS服务器下JavaEE环境搭建指南(远程桌面+JDK+Tomcat+MySQL)
--------------------------------------------------------------------------------1 系统设置:1.1 远程桌面设置:通过 ...
- ruby创建某些“关键字”方法别名的语法
begin和end是ruby的关键字,但是Range中也有名称为begin和end的实例方法.现在问题来了:怎么创建它们的别名方法? 如果用class Range;alias begin_x begi ...
- Fullpage.js全屏滚动jQuery插件
兼容性: 支持 IE8+ 及其他现代浏览器. 主要功能: 1.支持鼠标滚动: 2.支持前进后退键盘控制; 3.多个回调函数; 4.支持手机.移动设备; 5.支持窗口缩放自动调整; 6.可设置滚动宽度. ...
- jboss7开发配置指南
1 Jboss7下载与安装 1.1 官方下载 路径:http://www.jboss.org/jbossas/downloads,目前最新稳定版本为7.1.1 final,分别有zi ...