原文地址:http://blog.sina.com.cn/s/blog_a0de59cf0101dqeb.html

spring去加载,这个元素的写法如下:

<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中,没有ignore-unresolvable属性,所以就不能使用上面的那种方法去配置,

可以改如下的格式:

<bean id="propertyConfigurer"

class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="locations">

<list>

<value>classpath:/jdbc.properties</value>

</list>

</property>

</bean>

context:property-placeholder作用的更多相关文章

  1. Spring 注解<context:annotation-config> 和 <context:component-scan>的作用与区别

    <context:annotation-config> 是用于激活那些已经在spring容器里注册过的bean(无论是通过xml的方式还是通过packagesanning的方式)上面的注解 ...

  2. spring <context:annotation-config/> 注解作用

    <context:component-scan>包含<context:annotation-config/>的作用 <context:annotation-config/ ...

  3. Spring中<context:annotation-config/>的作用

    spring中<context:annotation-config/>配置的作用,现记录如下: <context:annotation-config/>的作用是向Spring容 ...

  4. Android开发中Context类的作用以及Context的详细用法

    Android中Context的作用以及Context的详细用法 本文我们一起来探讨一下关于Android中Context的作用以及Context的详细用法,这对我们学习Android的资源访问有很大 ...

  5. spring in action 学习十一:property placeholder Xml方式实现避免注入外部属性硬代码化

    这里用到了placeholder特有的一个语言或者将表达形式:${},spring in action 描述如下: In spring wiring ,placeholder values are p ...

  6. spring in action 学习十二:property placeholder 注解的方式实现避免注入外部属性硬代码化

    这里的注解是指@PropertySource这个注解.用@PropertySource这个注解加载.properties文件. 案例的目录结构如下: student.properties的代码如下: ...

  7. tools:context=".MainActivity的作用(转)

    android:layout_width="match_parent" android:layout_height="match_parent" android ...

  8. Android tools:context=".MainActivity"的作用

    <TextView android:layout_width="wrap_content" android:layout_height="wrap_content& ...

  9. “context:include-filter”与“context:exclude-filter”标签作用解释

    注意到spring中<context:component-scan>标签中会出现include和exclude的子标签,具体是做什么用的? spring的配置文件与springmvc的配置 ...

  10. tools:context=".MainActivity的作用

    <TextView android:layout_width="wrap_content" android:layout_height="wrap_content& ...

随机推荐

  1. 【HDOJ6305】RMQ Similar Sequence(笛卡尔树)

    题意: 给定一个数组a,现在存在一个数组b,其元素值在[0,1]随机生成 若对于a,b,任意rmq问题的最值出现在同一个数组中的位置,则数组b的价值为∑b[i],否则为0,求数组b的期望价值 n< ...

  2. rabbitmq management Login Failed

    默认用户guest 只允许localhost登录. so... 我们自己建立用户 1. 用户管理 用户管理包括增加用户,删除用户,查看用户列表,修改用户密码. 相应的命令 (1) 新增一个用户 rab ...

  3. wordpress优化:Gravatar头像被墙及解决方案

    网站缓存现象: 打开网站是左下角出现0.gravatar.com.1.gravatar.com或2.gravatar.com字样,网站一直处于缓存状态,迟迟未能打开.很多人都会缺乏耐心地等待一个网页的 ...

  4. 网络安全法与LogSec日志安全大数据审计平台

    https://blog.csdn.net/chengpeng1144/article/details/73555331 https://blog.csdn.net/dcbeyond/article/ ...

  5. The Bottom of a Graph

                                    poj——The Bottom of a Graph Time Limit: 3000MS   Memory Limit: 65536K ...

  6. Two Sum(hashtable)

    Given an array of integers, find two numbers such that they add up to a specific target number. The ...

  7. Spring MVC 异步处理请求,提高程序性能

    原文:http://blog.csdn.net/he90227/article/details/52262163 什么是异步模式 如何在Spring MVC中使用异步提高性能? 一个普通 Servle ...

  8. 中间件序列TDATASET为BUFFER演示代码

    procedure SendStream(const AStream: TStream);var Buffer: array[0..4095] of Byte; // 每包最大4K StartPos, ...

  9. 主成分分析(principal components analysis)

    http://www.cnblogs.com/jerrylead/tag/Machine%20Learning/ PCA的思想是将n维特征映射到k维上(k<n),这k维是全新的正交特征.这k维特 ...

  10. 【python】super()

    转自: http://www.cnblogs.com/lovemo1314/archive/2011/05/03/2035005.html