yuebintse

1、基本的使用方法是
<bean id="propertyConfigurerForWZ" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
    <property name="location"> 
        <value>classpath:/spring/properties/jdbc.properties</value> 
    </property> 

</bean>
2、当存在多个Properties文件时
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
    <property name="locations"> 
       <list> 
          <value>classpath:/spring/properties/jdbc.properties</value> 
          <value>/WEB-INF/conf/spring/system.properties</value> 
        </list> 
    </property> 
</bean> 
3、多个PropertyPlaceholderConfigurer要通过order属性指明加载顺序  
<bean id="propertyConfigurerForWZ" class="org.springframework.beans.factory.
config.PropertyPlaceholderConfigurer"> 
     <property name="order" value="1" /> 
    <property name="ignoreUnresolvablePlaceholders" value="true" /> 
    <property name="location"> 
       <value>classpath:/spring/include/dbQuery.properties</value> 
    </property> 
</bean>
 <bean id="propertyConfigurerForWZ" class="org.springframework.beans.factory.
config.PropertyPlaceholderConfigurer"> 
     <property name="order" value="2" /> 
    <property name="ignoreUnresolvablePlaceholders" value="true" /> 
    <property name="location"> 
       <value>classpath:/spring/include/dubbo.properties</value> 
    </property> 
</bean>

分类:

技术点:

相关文章:

  • 2021-08-01
  • 2021-10-17
  • 2019-11-22
  • 2021-11-26
  • 2021-06-22
  • 2021-12-10
  • 2021-11-08
  • 2021-10-07
猜你喜欢
  • 2021-09-19
  • 2022-01-04
  • 2021-09-19
  • 2021-10-31
  • 2021-05-01
  • 2021-12-14
  • 2021-09-08
相关资源
相似解决方案