首页 > 其他 > 详细

AOP Introduction理解

时间:2020-07-26 23:26:21      阅读:115      评论:0      收藏:0      [点我收藏+]

一、基本使用

Introduction引入:可以为某个或某些bean 动态实现某个接口。

@Aspect
class SingerIntroducer {           
     @DeclareParents(value="com.mengxiang.concert.Performance+", 
                defaultImpl = BackSinger.class)
     public static Singer singer;
}

这样所有实现Performance接口的Bean ,代理对象都实现了Singer接口
使用时强制转换下即可 (Singer)bean

 

二、场景?

 

参考:

https://www.jianshu.com/p/d1363a376ae8

https://my.oschina.net/zudajun/blog/663962

AOP Introduction理解

原文:https://www.cnblogs.com/yangfei629/p/13382200.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!