【发布时间】:2011-12-16 03:46:58
【问题描述】:
enter code here我有一个属性文件放在 etc 文件夹中。每个子模块中的“myapplication.properties”和其他一些属性文件..我正在尝试执行以下操作
<bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer">
<property name="searchContextAttributes" value="true"/>
<property name="contextOverride" value="true"/>
<property name="ignoreResourceNotFound" value="true"/>
<property name="locations">
<list>
<value>classpath:application.properties</value>
<value>${config}</value>
</list>
</property>
</bean>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreUnresolvablePlaceholders" value="true"/>
</bean>
我正在尝试 mvn -Dconfig=~/my.properties jetty:run
属性是从 application.properties 读取的,但不是从 config.. 读取的。
在运行应用程序时,我得到 ${jdbc.url} 不正确.. 此 url 存在于 my.properties 中.. 如何实现?
谢谢
【问题讨论】:
标签: spring spring-mvc properties