driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/ims?useUnicode=true&characterEncoding=utf-8
user=root
password=xxxxxx
<!-- 1、配置数据源 -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:database.properties</value>
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${user}"/>
<property name="password" value="${password}"/>
</bean>
原文:https://www.cnblogs.com/neuhuang/p/12761797.html