beanPostProcessor process understanding.

Preparation before testing:

  1. 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 
  2. 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
  3. Start the project and follow the process.

Key classes explained:

  1. 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

 

 

  1. 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.
  2. If not, a proxy class is generated.

 

Guess you like

Origin www.cnblogs.com/z-test/p/12710996.html