【发布时间】:2014-02-06 10:02:50
【问题描述】:
我有两个弹簧属性文件,一个用于集成测试,一个用于实际项目。属性文件大多相同,但在测试属性文件中,我有几个不同的属性用于测试目的。这是一个维护难题,每次我添加一个属性时,我都必须将它复制到测试属性文件中,即使它完全相同。我刚刚在测试中遇到了一个错误,这是由于测试属性文件尚未更新而引起的。
我有一个application-context-test.xml,它从项目application-context.xml 中导入了很多bean,但是覆盖了它出于测试目的需要的bean,我可以对属性文件做同样的事情吗?
这是我的属性文件配置
application-context.xml
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:myproject.properties"/>
</bean>
application-context-test.xml
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:myproject-test.properties"/>
</bean>
【问题讨论】:
标签: java spring properties