Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring AOP 避坑指南 #415

Open
TFdream opened this issue Mar 11, 2022 · 0 comments
Open

Spring AOP 避坑指南 #415

TFdream opened this issue Mar 11, 2022 · 0 comments

Comments

@TFdream
Copy link
Owner

TFdream commented Mar 11, 2022

无论是使用AspectJ语法,还是配合Annotation,使用AOP,实际上就是让Spring自动为我们创建一个Proxy,使得调用方能无感知地调用指定方法,但运行期却动态“织入”了其他逻辑,因此,AOP本质上就是一个代理模式。

因为Spring使用了 jdk Proxy/ CGLIB来实现运行期动态创建Proxy,如果我们没能深入理解其运行原理和实现机制,就极有可能遇到各种诡异的问题。

示例1:https://zhuanlan.zhihu.com/p/131584403

示例2:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant