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开发应用的时候,一般都会将数据库的配 ...
随机推荐
- HDFS读写数据过程
一.文件的打开 1.1.客户端 HDFS打开一个文件,需要在客户端调用DistributedFileSystem.open(Path f, int bufferSize),其实现为: public F ...
- linux 编译安装PHP模块
本文移到:http://www.phpgay.com/Article/detail/classid/6/id/54.html linux 编译安装PHP模块 1.首先你要有你服务器上安装的PHP的版 ...
- AngularJS进阶(三)HTML:让表单、文本框只读,不可编辑的方法
HTML:让表单.文本框只读,不可编辑的方法 有时候,我们希望表单中的文本框是只读的,让用户不能修改其中的信息,如使<input type="text" name=" ...
- Android控件属性android:visibility的invisible与gone的区别
"invisible" : 不可见 "gone" : 隐 藏 主要区别在于控件设置了invisible后控件不可见,但是保留了控件在界面上的空间, ...
- HBase Canary
HBase Canary 用于检测HBase 系统的状态.它对指定表的每一个region 抓取一行,来探测失败或者延迟. hbase org.apache.hadoop.hbase.tool.Can ...
- listview中的adapter学习小结
概述 Adapter是数据和UI之间的一个桥梁,在listview,gridview等控件中都会使用到,android给我们提拱了4个adapte供我们使用: BaseAdapter是一个抽象类,继承 ...
- LeetCode(46)-Remove Nth Node From End of List
题目: Given a linked list, remove the nth node from the end of list and return its head. For example, ...
- ubuntu12.04:Mysql数据库:自动安装
打开终端,输入下面命令: 1 sudo apt-get install mysql-server 2 sudo apt-get install mysql-client 一旦安装完成,MySQL 服务 ...
- ELF 文件 动态链接 - 地址无关代码(GOT)
Linux 系统中,ELF动态链接文件被称为 动态共享对象(DSO,Dynamic Shared Object),简称共享对象 文件拓展名为".so" 动态链接下 一个程序可以被分 ...
- asp.net 分布式探讨之Session共享问题
---恢复内容开始--- Session共享是分布式架构设计中的一大难点,尽管session共享的解决方案不少,但是.net 下的解决方案还是比较少,而且说明文档也很少. 之前尝试用memcached ...