Spring 加载Properties 多文件属性覆盖

 <bean id="MyPoperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="order" value="2"></property>
            <property name="locations">
                <list>
                    <value>classpath*:/common/*.properties</value>
                    <value>classpath*:/business/*.properties</value>
                </list>
            </property>
        </bean>

 order 指定加载顺序,后一个可覆盖前一个配置文件的同名属性。

如果未指定order ,则第二个配置文件中同名属性将被忽略。

猜你喜欢

转载自java12345678.iteye.com/blog/2243615