jdbc.properties文件内容
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8
jdbc.username=root
jdbc.password=root
spring文件中的相关内容
<!-- 2.数据库链接jdbc.properties文件 -->
<context:property-placeholder location="classpath:jdbc.properties"/>
<!-- 3.数据源DataSource-->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="maxActive" value="50"></property>
<property name="maxIdle" value="20"></property>
<property name="minIdle" value="5"></property>
<property name="maxWait" value="60000"></property>
<property name="initialSize" value="10"></property>
</bean>