XXX.xml
xmlns:util="http://www.springframework.org/schema/util"
<!-- 配置DRUID连接池 -->
<util:properties id="cfg" location="classpath:jdbc.properties"/>
<bean id="druidDataSource" class="com.alibaba.druid.pool.DruidDataSource"
destroy-method="close" init-method="init" lazy-init="true">
<property name="driverClassName" value="#{cfg.driver}" />
<property name="url" value="#{cfg.url}" />
<property name="username" value="#{cfg.username}" />
<property name="password" value="#{cfg.password}" />
</bean>
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/jsondata?useUnicode=true&characterEncoding=utf8
username=root
password=root123
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.23</version>
</dependency>