标签:
aspectjrt.jar
aspectjweaver.jar
cglib-nodep-2.1_3.jar
commons-dbcp.jar
commons-logging.jar
commons-pool.jar
mysql-connector-java-5.1.10-bin.jar
spring.jar
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!--
用于配置解析文件
引入prperties配置文件
-->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean>
<bean id="dataSource" destroy-method="close"
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}" />
</bean>
<bean id="personDao3" class="com.spring.jdbc.dao.PersonDao">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
</beans>
package com.spring.jdbc.dao;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
public class PersonDao extends JdbcDaoSupport{
public void savePerson(String sql){
this.getJdbcTemplate().execute(sql);
}
}
标签:
原文地址:http://www.cnblogs.com/thinkpad/p/4940823.html