<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"></property> <property name="url" value="jdbc:mysql://127.0.0.1:3306/gong1?useUnicode=true&characterEncoding=utf8&"></property> <property name="username" value="root"></property> <property name="password" value="123456"></property>
<context:property-placeholder location="conf/jdbc.properties"/> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"></property> <property name="url" value="${jdbc.url}"></property> <property name="username" value="${jdbc.username}"></property> <property name="password" value="${jdbc.password}"></property>
jdbc.url=jdbc:mysql://127.0.0.1:3306/gong?useUnicode=true&characterEncoding=utf8& jdbc.username=root jdbc.password=123456
<context:property-placeholder location="file:./conf/jdbc.properties"/> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"></property> <property name="url" value="${jdbc.url}"></property> <property name="username" value="${jdbc.username}"></property> <property name="password" value="${jdbc.password}"></property>
jdbc.url=jdbc:mysql://127.0.0.1:3306/gong?useUnicode=true&characterEncoding=utf8& jdbc.username=root jdbc.password=123456
原文地址:http://blog.csdn.net/qing_gee/article/details/45083053