一直以为spring的ioc容器生成的对象都是代理对象,其实这个是错误的。spring ioc默认的都是原生对象  只有通过aop增强的对象才是代理对象

有@Transactional  注解或者配置文件

<aop:config>
   <aop:pointcut id="txPointcut" expression="execution(* com..service.impl.*.*(..))" />
   <aop:advisor pointcut-ref="txPointcut" advice-ref="txAdvice" />
</aop:config>

有配置接口aop增强的类   得到的对象都是代理对象。

设置cglib动态代理针对于类的:

<aop:aspectj-autoproxy proxy-target-class="true"/>

注意:事物的传播机制也只有是代理对象操作的方法才起作用  

相关文章:

  • 2022-12-23
  • 2021-05-27
  • 2022-01-23
  • 2021-05-30
  • 2021-10-09
  • 2021-10-03
  • 2022-12-23
猜你喜欢
  • 2021-11-11
  • 2020-02-09
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2018-11-08
  • 2022-12-23
相关资源
相似解决方案