混合带注释的Bean和声明性AOP事务

时间:2015-02-04 01:50:24

标签: spring transactions annotations

我有一个使用Declarative AOP transcation的现有项目,我想使用@ Service,@ Repository,@ Component添加Annotated Beans,但是事务不适用于Annotated Services,但声明bean没有问题,我的问题是可以在一个项目中混合Annotated Beans和Declarative AOP transcation,如果是这样,如何实现它?声明性bean和带注释的bean之间有什么区别吗?如果这个问题太愚蠢,请不要理睬我,提前谢谢。

1 个答案:

答案 0 :(得分:0)

发现问题,servlet-context级别再次扫描DAO,Manager,Service层,但是事务是在应用程序上下文级别定义的,解决方案是使servlet-context级别只扫描Controller。