源地址:
方法4:在 JdbcTemplate_3的基础上(继承JdbcDaoSupport),改动配置文件,如下(最常用)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
  xmlns:xsi=""
     xmlns:aop=""
     xmlns:tx=""
     xmlns:context=""
  xsi:schemaLocation="
   
   
   
    ">
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
      <property name="driverClassName" value="${driverClassName}" />
      <property name="url" value="${url}" />
      <property name="username" value="${username}" />
      <property name="password" value="${password}" />
      <property name="initialSize" value="${initialSize}" />
      <property name="maxActive" value="${maxActive}" />
      <property name="minIdle" value="${minIdle}" />
      <property name="maxIdle" value="${maxIdle}" />
  </bean>
 
  <bean id="footBallService" class="ajdbc.service.impl.FootBallServiceImpl">
     <property name="dataSource" ref="dataSource" />
     <!--  <property name="jdbcTemplate" ref="jdbcTemplate" /> -->
  </bean>
  
  <context:property-placeholder location="classpath:jdbc.properties" />
  <!-- 
  <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
      <property name="dataSource" ref="dataSource" />
  </bean>
  -->
</beans>