Spring AOP doesn't work

1. Define the tangent point directly in the aspect class;

All the methods in the AOP aspect class do not support triggering the aspect, otherwise an aspect function that regards itself as a pointcut will cause recursive calls.

The AOP aspect class will not trigger the aspect when the function call is issued, so as to avoid the situation where the two aspect classes call each other for iterative requests.

2. The two pointcut methods of the proxied object are called internally;

For a class enhanced by Spring's AOP, when an internal method of the same class is called, the enhanced advice on the called method will not work, that is, Spring's transaction propagation strategy will not work when the internal method is called, no matter what you want. A method requires a separate transaction, whether it is RequiresNew, or nested transactions, Nested, etc., all of which do not work. Not just transaction notifications, but all notifications implemented with AOP are subject to the same restrictions.

Spring AOP source code analysis (8) Spring AOP should pay attention to

Summary of spring aop automatic proxy annotation configuration failure problem and principle mechanism

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324659987&siteId=291194637