spring application.xml中加载配置文件

application.xml同级目录constant.properties

<bean id="propertyPlaceHolderConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
        <property name="ignoreResourceNotFound" value="true" />
        <property name="locations">
            <list>
                <value>classpath:constant.properties</value>
            </list>
        </property>
    </bean>
   
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">
        <property name="driverClass" value="${jdbc.driverClassName}" />
        <property name="jdbcUrl" value="${jdbc.url}" />
        <property name="user" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
        <property name="preferredTestQuery" value="select 1" />
        <property name="testConnectionOnCheckout" value="true" />
        <property name="maxPoolSize" value="1" />
    </bean>

猜你喜欢

转载自lvzhou-31.iteye.com/blog/2063902