<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
        <property name="location">  
            <value>/WEB-INF/reportConfig.properties</value>  
        </property>  
        <property name="fileEncoding" value="utf-8"/>  
    </bean>  
1.<bean id="configBean" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">   
2.    <property name="locations">   
3.         <list>  
4.             <value>classpath*:properties1.properties</value>   
5.             <value>properties2.properties</value>   
6.             <value>properties3.properties</value>  
7.         </list>  
8.    </property>       
9.</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location">
            <value>file:c:/reportConfig.properties</value>
        </property>
        <property name="fileEncoding" value="utf-8"/>
    </bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location">
            <bean class="java.lang.System" factory-method="getenv">
                <constructor-arg value="CIRC_REPORT"/>
            </bean>
        </property>
        <property name="fileEncoding" value="utf-8"/>
    </bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
         <property name=”ignoreResourceNotFound” value=”true”/>
    <property name="location">
        <value>${CIRC_REPORT}</value>
    </property>
    <property name="fileEncoding" value="utf-8"/>
</bean>

引用同过${} 例如

<bean id="iSignedClient" class="com.erayt.xdeskoption.signedsock.SignedJDKClient"
        scope="singleton" autowire="byName" destroy-method="destroy">
        <property name="port">
            <value>${bocServer.Port}</value>
        </property>
        <property name="host">
            <value>${bocServer.Host}</value>
        </property>
    </bean>

属性文件格式如下

optionServer.Host=127.0.0.1
optionServer.Port=9977
optionServer.TimeOut=2

bocServer.Host=127.0.0.1
bocServer.Port=9000

#Signed Server
#signedServer.host=localhost
#signedServer.port=9000
signedServer.timeout=30

encrypt.key=XDESK

ClientVersion=2012052801
MaxPipe=1000
posted on 2012-06-14 15:35  饭菜糖衣  阅读(203)  评论(0)    收藏  举报