Spring 资源文件 properties 的配置
来源:互联网 发布:mac在广州哪里有专柜 编辑:程序博客网 时间:2024/06/09 21:41
Spring简化了加载资源文件的配置,可以通过<context:property-placeholder去加载,这个元素的写法如下:
<context:property-placeholder location="classpath:jdbc.properties"/>
如果想要配置多个properties文件
<context:property-placeholder location="classpath:jdbc.properties"/>
<context:property-placeholder location="classpath:jdbc.properties"/>
这种方式是不被允许的,一定会出"Could not resolve placeholder"。
解决方案:
(1) 在Spring 3.0中,可以写:
<context:property-placeholder location="xxx.properties" ignore-unresolvable="true"/>
<context:property-placeholder location="xxx.properties" ignore-unresolvable="true"/>
(2) 但是在Spring 2.5中,<context:property-placeholder>没有ignore-unresolvable属性,所以就不能使用上面的那种方法去配置,
可以改如下的格式:
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:/jdbc.properties</value>
</list>
</property>
</bean>
- Spring - 资源文件properties的配置
- Spring 资源文件 properties 的配置
- Spring - 资源文件properties的配置
- Spring - 资源文件properties的配置
- Spring - 资源文件properties的配置
- Spring加载properties配置资源文件的应用
- web.xml、.properties资源文件的配置
- SystemProperties读取资源文件.properties文件的配置属性
- Struts1.2总结,web.xml、.properties资源文件的配置
- spring xml配置properties文件
- spring配置读取properties文件
- spring properties 资源文件 方式一
- Spring加载资源文件的配置
- properties文件的配置
- properties文件的配置
- spring如何引用properties文件里的配置
- Spring如何引用properties文件里的配置
- spring如何引用properties文件里的配置
- 迅速搭建lamp环境
- mybatis
- uva 1368 DNA Consensus String
- 解释型语言和编译型语言有什么区别
- Linux:HDMI驅動之EDID
- Spring 资源文件 properties 的配置
- OpenCV中关于SetMouseCallback的解释
- 解决了一个很难的问题上传文件 到FTP
- vs2005中查看对象的内存布局
- 【Informatica】使用Expression组件实现自增序列
- 平面上N个点,每两个点都确定一条直线, 求出斜率最大的那条直线所通过的两个点
- USIM卡与SIM的区别
- 生成Doc文档
- uva 1424 商人