Preparation before testing:
- Use springboot web to build the project, and add @Async to the service (to use @EnableAsync to start asynchronous processing) and @Validated. This service must pass these two corresponding beanPostProcessors when it is initialized
- Add a breakpoint to the postProcessAfterInitalization in abstractAdvisingBeanPostProcessor , and configure the condition of the breakpoint as beanName.contains ("testServiceImpl") where testServiceImpl adds us the service name of @Async and @Validated
- Start the project and follow the process.
Key classes explained:
- When generating a proxy class for a service, an interface list is specified, and we usually specify only one. Note: At least one of our services is set as the interface Advised
- Determine whether the current object generates a proxy class. If a proxy class has been generated (the Advised interface must have been proxied), the aspect class of the current class will be added to the aspect list of the proxy class.
- If not, a proxy class is generated.