我熟悉Spring AOP.正如我在春季文档http://docs.spring.io/spring/docs/3.1.x/spring-framework-reference/html/aop.html中所读到的,Spring AOP致力于代理的概念.
在8.2.3.1支持的切入点指示符部分中,我找到了以下注释
Due to the proxy-based nature of Spring’s AOP framework,protected
methods are by deFinition not intercepted,neither for JDK proxies
(where this isn’t applicable) nor for cglib proxies (where this is
technically possible but not recommendable for AOP purposes). As a
consequence,any given pointcut will be matched against public methods
only!
起初,我不相信它,所以我试图在不使用接口的情况下实现它,默认情况下所有方法都是公开的,并且对上述情况感到惊讶.由于代理类是建议/目标对象的子类,受保护的方法可以由子类访问,所以我认为受保护的方法可以正常工作.
最佳答案
JDK代理基于接口,这意味着所有实现的方法都是公共的
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。