
您缺少TransactionManager定义,请参阅http://docs.spring.io/spring-
framework/docs/current/spring-framework-
reference/html/transaction.html
[更新]以前我是用手机写的,所以很难提供详细信息,这是您需要做的:
Spring xml配置:
<tx:annotation-driven/>
将@Transactional批注添加到CustomerDaoImpl.insertCustomer方法
现在您的代码应该可以工作了。
请注意 ,@ Transactional批注应在服务层中使用,而不是在本示例中的DAO层中使用。
@Transactional注释告诉spring创建代理,该代理使用方面使用事务“包装”带注释的方法。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)