Spring中加载多个Properties配置文件
单个配置:
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:jdbc.properties</value>
</property>
</bean>
多个配置:
<!-- 将多个配置文件读取到容器中,交给Spring管理 -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<!-- 这里支持多种寻址方式:classpath和file -->
<value>classpath:/opt/demo/config/demo-db.properties</value>
<!-- 推荐使用file的方式引入,这样可以将配置和代码分离 -->
<value>file:/opt/demo/config/demo-mq.properties</value>
<value>file:/opt/demo/config/demo-remote.properties</value>
</list>
</property>
</bean>
最新文章
- 【原创】js中input type=file的一些问题
- 对COM 组件的调用返回了错误 HRESULT E_FAIL
- php 多条数据更新
- UrlRewrite伪静态
- python sort和sorted的区别以及使用方法
- iOS加载程序视图的方式
- linux系统中删除文件夹
- js JSONP实例
- CODEVS 3138 栈练习2
- The Frog&#39;s Games(二分)
- hdu Hat&#39;s Fibonacci
- 纯Jquery前端分页
- 荣获MVP感想
- python自动化运维七:fabric
- day47-python爬虫学习二
- 如何将vue/html在Hbuilder里进行apk打包封装生成直接可用程序
- componentWillMount和componentDidMount的区别
- MikroTik RouterOS授权级别
- 浙江工业大学校赛 小M和天平
- 修改MySQL数据库中表和表中字段的编码方式的方法