原文地址: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. centos 6.5 yum安装lnmp

    转自:http://blog.csdn.net/lane_l/article/details/20235909 准备篇: 端口 vi /etc/sysconfig/iptables -A INPUT ...

  2. 【ZJOI2017 Round1练习】D2T2 iqtest(排列组合)

    题意: 思路: 根据欧拉定理,a^(phi(n)-1)为a mod n的逆元 ..]of longint; s,ans,x,mo,k,phi,tmp:int64; i,m,n,j:longint; f ...

  3. Git学习之常见错误 clone被拒绝

    Git学习之常见错误 问题: git clone 时 报错 Permission Denied (权限被拒绝). 解决方法: 需要把本地的公钥上传到服务器. 解决步骤: ①第一步,设置本地的git的用 ...

  4. React学习及实例开发(一)——开始

    本文基于React v16.4.1 初学react,有理解不对的地方,欢迎批评指正^_^ 一.构建一个新项目 1.命令行运行如下命令,构建一个新的react项目 npm install -g crea ...

  5. LightOJ1094 - Farthest Nodes in a Tree(树的直径)

    http://lightoj.com/volume_showproblem.php?problem=1094 Given a tree (a connected graph with no cycle ...

  6. OO第三单元总结--根据JML写代码

    一. JML语言 1. 理论基础 首先,JML不是JAVA的一部分,它是一群研究者为JAVA设计的扩展部分,但还没有得到官方的支持.因此,JAVA编译器并不支持JML,所以要想JML起作用,只能采用类 ...

  7. webpack体积优化篇一

    定位 webpack 大的原因   这里推荐使用 webpack-bundle-analyzer —— Webpack 插件和 CLI 实用程序,她可以将内容束展示为方便交互的直观树状图,让你明白你所 ...

  8. 【.Net Core 学习系列】-- EF Core实践(DB First)

    一.开发环境: VS2015, .Net Core 1.0.0-preview2-003156 二.准备数据: CREATE DATABASE [Blogging]; GO USE [Blogging ...

  9. java获取本机机器名

    java获取本机机器名 InetAddress.getLocalHost().getHostName().toString();

  10. Python遍历路径下文件并转换成UTF-8编码

    http://www.cnblogs.com/wuyuegb2312/archive/2013/01/11/2856772.html 开始学Python,这篇文章来自于应用需求. os.walk很方便 ...