spring配置文件中的配置
一、PropertyPlaceholderConfigurer 属性文件放置配置
<bean 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*:/application.properties</value> </list> </property> </bean>
二、数据源及数据连接池配置
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <!-- Connection Info --> <property name="driverClassName" value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <!-- Connection Pooling Info --> <property name="initialSize" value="${jdbc.initialSize}" /> <property name="maxActive" value="${jdbc.maxActive}" /> <property name="maxIdle" value="${jdbc.maxIdle}" /> <property name="maxWait" value="${jdbc.maxWait}" /> <property name="poolPreparedStatements" value="${jdbc.poolPreparedStatements}" /> <property name="defaultAutoCommit" value="${jdbc.defaultAutoCommit}" /> </bean>