弹簧属性文件中的Escape属性引用 [英] Escape property reference in spring property file
本文介绍了弹簧属性文件中的Escape属性引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在一个肯定是小学的问题上疯了。我只想逃脱我的spring propeties文件,以获取我的bean属性: $ {ROOTPATH} / relativePath
I'm going crazy on an issue that is certainly elementary. I just want to escape my spring propeties file in order to get in my bean property: ${ROOTPATH}/relativePath
我有一个简单的spring配置文件包含:
I have a simple spring config file that contains:
<context:property-placeholder location="classpath:myprops.properties" />
<bean id="myBean" class="spring.MyBean">
<property name="myProperty" value="${myproperty}" />
</bean>
myprops.properties包含:
The myprops.properties contains:
myproperty=\${ROOTPATH}/relativePath
以上安装程序返回:无法解析占位符ROOTPATH。我尝试了很多可能的语法,但无法找到正确的语法:/
The above setup returns: Could not resolve placeholder 'ROOTPATH'. I tried a lot of possible syntaxes but was not able to find the right one :/
感谢您的帮助。
推荐答案
而不是 $ {myproperty}
使用#{'$'} {myproperty} code>。只需将
$
替换为#{'$'}
。
这篇关于弹簧属性文件中的Escape属性引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文