spring application.xml中載入配置檔案

lvzhou_MadSky發表於2014-05-08

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>

相關文章