我正在尝试将工作的 spring WAR 移动到 OSGI 环境(在 glassfish 3.1 和蓝图,spring 3.0.5 中)。应用程序从磁盘加载属性文件,如下所示:
<bean id="myProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="${my_conf}/my.properties"/>
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
</bean>
我在调试器中看到${my_conf}/my.properties
已转换为现有路径 (c:\conf\my.properties)
我使用在下一个 bean 声明中jms.url
定义的属性my.properties
<amq:broker useJmx="false" persistent="false" brokerName="embeddedbroker">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://${jms.url}"/>
<amq:transportConnector uri="vm://embeddedbroker" />
</amq:transportConnectors>
</amq:broker>
在部署中我得到一个例外"Could not resolve placeholder ${jms.url}"
为什么会失败?还有另一种方法可以从磁盘上的文件加载属性吗?
谢谢你