context:property-placeholder作用
原文地址: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作用的更多相关文章
- Spring 注解<context:annotation-config> 和 <context:component-scan>的作用与区别
<context:annotation-config> 是用于激活那些已经在spring容器里注册过的bean(无论是通过xml的方式还是通过packagesanning的方式)上面的注解 ...
- spring <context:annotation-config/> 注解作用
<context:component-scan>包含<context:annotation-config/>的作用 <context:annotation-config/ ...
- Spring中<context:annotation-config/>的作用
spring中<context:annotation-config/>配置的作用,现记录如下: <context:annotation-config/>的作用是向Spring容 ...
- Android开发中Context类的作用以及Context的详细用法
Android中Context的作用以及Context的详细用法 本文我们一起来探讨一下关于Android中Context的作用以及Context的详细用法,这对我们学习Android的资源访问有很大 ...
- spring in action 学习十一:property placeholder Xml方式实现避免注入外部属性硬代码化
这里用到了placeholder特有的一个语言或者将表达形式:${},spring in action 描述如下: In spring wiring ,placeholder values are p ...
- spring in action 学习十二:property placeholder 注解的方式实现避免注入外部属性硬代码化
这里的注解是指@PropertySource这个注解.用@PropertySource这个注解加载.properties文件. 案例的目录结构如下: student.properties的代码如下: ...
- tools:context=".MainActivity的作用(转)
android:layout_width="match_parent" android:layout_height="match_parent" android ...
- Android tools:context=".MainActivity"的作用
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content& ...
- “context:include-filter”与“context:exclude-filter”标签作用解释
注意到spring中<context:component-scan>标签中会出现include和exclude的子标签,具体是做什么用的? spring的配置文件与springmvc的配置 ...
- tools:context=".MainActivity的作用
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content& ...
随机推荐
- android开发里跳过的坑——android studio打包的APK签名无效
近期把一个项目从eclipse上移植到了android studio, 在打包发布APK的时候,应用上传到应用市场时提示取不到签名.但是,我确实使用了 做过签名了. 然后换了一种打包方式 build ...
- Python()-类命名空间和对象/实例命名空间
类命名空间和对象/实例命名空间: 创建类, 就会创建一个类的名称空间, 空间:存储类的属性 属性: 静态属性:直接定义在类下面 & 和类名关联 的变量 对象属性:在类内和self关联 & ...
- 离线配置Anaconda3+tensorflow-gpu1.4.0+cuda8.0+cudnn6.0
1.首先下载anaconda3 ----从官网上下载Anaconda3-5.1.0-Linux-x86_64.sh 直接通过命令 bash Anaconda3-5.1.0-Linux-x86_64.s ...
- 清北省选 DAY last 集锦
这是题目描述的链接: http://lifecraft-mc.com/wp-content/uploads/2018/03/problems1.pdf (虽然这次没去清北,但还是厚颜无耻的做了一下这套 ...
- PHP的类中的常量,静态变量的问题。
自己在写一个小型的 angularJS 库的时候,觉得 javascript 中的很多概念有点像是PHP中的概念. 像类常量, 类中的静态变量(类的静态变量是类的所有实例都共享的),这些概念虽然在 j ...
- 为Java说句公道话
为Java说句公道话 有些人问我,在现有的语言里面,有什么好的推荐?我说:"Java. " 他们非常吃惊:"什么?Java!" 所以我如今来解释一下. Java ...
- 奥斯卡·王尔德十大经典语录
10不够真诚是危急的,太真诚则绝对是致命的.--摘自<身为艺术家的评论者> "A little sincerity is a dangerous thing, and a gre ...
- c# 把一个匿名对象赋值给一个Object类型的变量后,怎么取这个变量? c# dynamic动态类型和匿名类 详解C# 匿名对象(匿名类型)、var、动态类型 dynamic 深入浅析C#中的var和dynamic
比如有一个匿名对象,var result =......Select( a=>new { id=a.id, name=a.name});然后Object obj = result ;我怎 ...
- oracle 正则查询json返回报文中某个字段的值
接口返回报文为json 格式,如下: {"body":{"businessinfo":{"c1rate":"25.00" ...
- Ioc 器管理的应用程序设计,前奏:容器属于哪里? 控制容器的反转和依赖注入模式
Ioc 器管理的应用程序设计,前奏:容器属于哪里? 我将讨论一些我认为应该应用于“容器管理”应用程序设计的原则. 模式1:服务字典 字典或关联数组是我们在软件工程中学到的第一个构造. 很容易看到使 ...