spring - spring aop代理对象如何知道调用哪个advice
问题描述
我 kbow 代理对象扩展了目标类并覆盖了非最终方法。我的问题是,当代理对象覆盖目标方法时,它向目标方法添加了哪些额外的代码来调用建议?以及代理如何知道何时调用建议,之前,之后等?
解决方案
What you are asking is a bit too broad since the code used is quite complex.
I'm not sure why do you want to know the exact implementation details but as starting point you should check how Spring AOP works: https://docs.spring.io/spring/docs/5.1.x/spring-framework-reference/core.html#aop
Spring implements proxying by using CGLIB or the JDK depending the situation (i.e.: if you implement your beans using interfaces, Spring will try to use the JDK). You can check the Proxying mechanisms here: https://docs.spring.io/spring/docs/5.1.x/spring-framework-reference/core.html#aop-proxying
From there you can search for the libraries and check the code used for proxying.
I hope this serves you as a starting point for your reasearch.
推荐阅读
- r - 从长到宽重塑或表格数据
- java - 如何在场景中为 FXML 中定义的对象设置 KeyEvent?
- json - ElasticSearch JSON 预期
- bash - “运行当前块”不适用于 bash(在 Windows 10 上)
- python - Converting a graph into dictionary form
- javascript - 如果语言不是波斯语,则会收到错误消息
- scala - 如何将 SortedSet 迁移到 Seq 或 Array 以使用 Spark 的 Dataset API 和 Encoders?
- r - 基于用户输入的 R 闪亮子集,然后基于子集的代码
- svg - Vue PWA 模板,使用 SVG 精灵
- python - 连续行满足多个条件时的文件解析