在我的项目中,我有多个上下文文件。在那里我使用下面的属性占位符加载属性文件。如何为整个项目配置单个Propery占位符
下面是我的context.xml文件。
a.xml
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="file:${conf.path}/devconfiguration.xml" />
<!--<property name="location" value="file:${conf.path}/sitconfiguration.xml" />
<property name="location" value="file:${conf.path}/uatconfiguration.xml" />
<property name="location" value="file:${conf.path}/prodconfiguration.xml" />-->
</bean>
b.xml
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="file:${conf.path}/devconfiguration.xml" />
<!--<property name="location" value="file:${conf.path}/sitconfiguration.xml" />
<property name="location" value="file:${conf.path}/uatconfiguration.xml" />
<property name="location" value="file:${conf.path}/prodconfiguration.xml" />-->
</bean>
c.xml
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="file:${conf.path}/devconfiguration.xml" />
<!--<property name="location" value="file:${conf.path}/sitconfiguration.xml" />
<property name="location" value="file:${conf.path}/uatconfiguration.xml" />
<property name="location" value="file:${conf.path}/prodconfiguration.xml" />-->
</bean>
每次我们要改变所有的上下文文件时,我们会收集战争文件。他们是否有办法为整个项目建立一个财产占有者? 我试过了,但无法使用属性占位符bean加载属性文件。任何帮助将不胜感激。
可能取决于构建工具 - [maven](https://maven.apache.org/guides/mini/guide-building-for-different-environments.html)。 –