proxy-target-class="false"与proxy-target-class="true"区别

原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11484063.html

 

<aop:aspectj-autoproxy proxy-target-class="false"/> 基于接口,使用JDK动态代理

JDK Dynamic proxy can only proxy by interface (so your target class needs to implement an interface, which will also be implemented by the proxy class).

 

<aop:aspectj-autoproxy proxy-target-class="true"/> 基于类,需要使用cglib库

CGLIB (and javassist) can create a proxy by subclassing. In this scenario the proxy becomes a subclass of the target class. No need for interfaces.

 

Note:

这两种代理方式的使用使用了 策略模式 。

 

转载于:https://www.cnblogs.com/agilestyle/p/11484063.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值