标签:jdbc init 如何使用 class source 如何 备忘 auto initial
@Repository
public class MyDaoImpl extends JdbcDaoSupport implements MyDao {
@Autowired
private DataSource dataSource;
@PostConstruct
private void initialize() {
setDataSource(dataSource);
}
public void In(String user, double money) {
String sql = "update account set money = money + " + money + " where name=‘" + user + "‘";
this.getJdbcTemplate().update(sql);
}
public void Out(String user, double money) {
String sql = "update account set money = money - ? where name=?";
this.getJdbcTemplate().update(sql, money, user);
}
}
备忘于此
如何使用 AutoWire方式注入 JdbcDaoSupport DataSource
标签:jdbc init 如何使用 class source 如何 备忘 auto initial
原文地址:http://www.cnblogs.com/zbw911/p/6530376.html