Spring占位符格式 [英] Spring placeholder format
本文介绍了Spring占位符格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是正在运行的语法
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:application.properties"/>
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
</bean>
这是另一种不起作用的格式
This is alternative format which is NOT working
<context:property-placeholder location="classpath:application.properties" system-properties-mode="OVERRIDE"/>
任何想法为什么?在建造时我会经常进行测试。
Any ideas why? I will always crach on tests while building.
应用程序属性文件只包含这个
hibernate.show.sql = false
hibernate.format.sql = true
Application properties file contains just this hibernate.show.sql = false hibernate.format.sql = true
推荐答案
您的语法看起来正确。您是否在上下文文件中注册了 context
命名空间?
Your syntax looks correct. Do you have the context
namespace registered in your context file?
例如:
<beans ...
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="...
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
这篇关于Spring占位符格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文