调用对象和目标对象的区别?

问题描述 投票:0回答:1

我正在学习Spring AOP,这个概念有一些术语,比如Advice , PointCut , JoinPoint ......其中一个是AOP Proxy,我发现代理是一个中间对象,由AOP框架引入,在调用对象和目标对象之间。所以我的问题是调用对象和目标对象之间的区别是什么?

spring-aop
1个回答
0
投票

Plese go through the reference document section : 了解AOP Proxies

以下图片描述了代理的概念。

enter image description here

考虑一个类 TestService 有办法 run() 和类 Pojo 有办法 foo(). 也可以考虑Spring框架创建一个代理 Pojo .

@Component
public class TestService{

  @Autowired  
  Pojo pojo;

  public void run(){
     pojo.foo()
  }

}

这里的 TestService 是调用对象和 Pojo 是目标对象。

© www.soinside.com 2019 - 2024. All rights reserved.