Introduction: Spring extension point is an important embodiment of Spring easy to expand, familiar with the definition of these extension points, as well as its call time, we can be in the process of development with ease, a variety of SAO operations. I personally think it is very necessary to be familiar with them and know their principles. Today we will look at them one by one.

This article summarizes 10 extension points, if any omissions are welcome to add ~

  • The sample code for this article has been uploaded to Githubaddress: Github.com/598572/xzll…

The extension point 1

Implement ApplicationContextInitializer the initialize method

  • PrepareContext (Context, environment, Listeners, applicationArguments, printedBanner); All configuration files have been loaded
/ * * * ApplicationContextInitializer extension point presentation time: Before the Spring container is refreshed * * 

* Because the Spring container is not refreshed at this time, there are three ways to make your extension work: *

* 1. At startup class using springApplication. AddInitializers (new ApplicationContextInitializerPoint ()) statement to join * 2. Configuration file configuration context., initializer. Classes = com. XZLL. Test. ApplicationContextInitializerPoint * 3. The Spring SPI extension, In the spring. The factories to add org. Springframework. Context. ApplicationContextInitializer = com. XZLL. Test. ApplicationContextInitialize RPoint *

* //TODO so far I have tried three methods. Only the second method can output the print statement of this class. 1 and 2 do not output the print statement. Reserved for later research * * this is the spring container before refresh initialization ConfigurableApplicationContext callback interface, in simple terms, is to call before the container to refresh the initialize method. * This dot is allowed to be extended by the user himself. The user can do some things before the entire Spring container is initialized. * Possible scenarios include activating some configuration initially, or performing dynamic bytecode injection while the class is not being loaded by the class loader. * /

public class ApplicationContextInitializerPoint implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(ConfigurableApplicationContext applicationContext) { // System.out.println("applicationContext: "+ JSON.toJSONString(applicationContext)); / / note that there won't introduce FastJson complains AnnotationConfigApplicationContext from had been refreshed yet; AnnotationConfigApplicationContext has yet to refresh / / see the: https://stackoverflow.com/questions/28404817/annotationconfigapplicationcontext-has-not-been-refreshed-yet-whats-wrong System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- ApplicationContextInitializerPoint # initialize start -- -- -- -- -- -- -- -- -- -- -- -- --"); System.out.println("[ApplicationContextInitializer extension point presentation] # initialize:" + applicationContext.toString()); System.out.println("BeanDefinitionCount count: " + applicationContext.getBeanDefinitionCount()); ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); Iterator<String> beanNamesIterator = beanFactory.getBeanNamesIterator(); beanNamesIterator.forEachRemaining(System.out::println); System.out.println("Timing:"+ "This.preparecontext () in the run method; When"); System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- ApplicationContextInitializerPoint # initialize end -- -- -- -- -- -- -- -- -- -- -- --"); System.out.println(); } /* private void prepareContext(ConfigurableApplicationContext context, ConfigurableEnvironment environment, SpringApplicationRunListeners listeners, ApplicationArguments applicationArguments, Banner printedBanner) { context.setEnvironment(environment); this.postProcessApplicationContext(context); this.applyInitializers(context); listeners.contextPrepared(context); if (this.logStartupInfo) { this.logStartupInfo(context.getParent() == null); this.logStartupProfileInfo(context); } ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); beanFactory.registerSingleton("springApplicationArguments", applicationArguments); if (printedBanner ! = null) { beanFactory.registerSingleton("springBootBanner", printedBanner); } if (beanFactory instanceof DefaultListableBeanFactory) { ((DefaultListableBeanFactory)beanFactory).setAllowBeanDefinitionOverriding(this.allowBeanDefinitionOverriding); } Set sources = this.getAllSources(); Assert.notEmpty(sources, "Sources must not be empty"); this.load(context, sources.toArray(new Object[0])); listeners.contextLoaded(context); } protected void applyInitializers(ConfigurableApplicationContext context) { Iterator var2 = this.getInitializers().iterator(); while(var2.hasNext()) { ApplicationContextInitializer initializer = (ApplicationContextInitializer)var2.next(); Class requiredType = GenericTypeResolver.resolveTypeArgument(initializer.getClass(), ApplicationContextInitializer.class); Assert.isInstanceOf(requiredType, context, "Unable to call initializer."); initializer.initialize(context); // todo calls the initialize method}} */ } Copy the code

The extension point 2

Implement BeanDefinitionRegistryPostProcessor or spring BeanFactoryPostProcessor postProcessBeanDefinitionRegistry and PostProcessBeanFactory method

  • Timing: refresh () enclosing invokeBeanFactoryPostProcessors (the beanFactory); At this point, the bean definition information has been loaded but has not yet been instantiated or initialized
@Component
public class BeanDefinitionRegistryPostProcessorPoint implements BeanDefinitionRegistryPostProcessor {

   @Override
   public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [BeanDefinitionRegistryPostProcessor extension point presentation] # postProcessBeanDefinitionRegistry Start -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println("[BeanDefinitionRegistryPostProcessor extension point presentation] # postProcessBeanDefinitionRegistry");
      System.out.println("Timing: refresh () enclosing invokeBeanFactoryPostProcessors (the beanFactory); Method to execute; " +
            "At this point the bean definition information has been loaded but has not yet been instantiated or initialized.");
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [BeanDefinitionRegistryPostProcessor extension point presentation] # postProcessBeanDefinitionRegistry End -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println();
   }

   @Override
   public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [BeanDefinitionRegistryPostProcessor extension point presentation] # postProcessBeanFactory Start -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println("[BeanDefinitionRegistryPostProcessor extension point presentation] # postProcessBeanFactory");
      System.out.println("Timing: refresh () enclosing invokeBeanFactoryPostProcessors (the beanFactory); Method to execute; " +
            "At this point the bean definition information has been loaded but has not yet been instantiated or initialized.");
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [BeanDefinitionRegistryPostProcessor extension point presentation] # postProcessBeanFactory End -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --"); System.out.println(); }}Copy the code
@Component
public class BeanFactoryPostProcessorPoint implements BeanFactoryPostProcessor {
   @Override
   public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [spring BeanFactoryPostProcessor extension point presentation] # postProcessBeanFactory Start -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println([BeanFactoryPostProcessor extension point demo] # postProcessBeanFactory);
      System.out.println("Timing: refresh () enclosing invokeBeanFactoryPostProcessors (the beanFactory); Method to execute; " +
            "At this point the bean definition information has been loaded but has not yet been instantiated or initialized.");
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [spring BeanFactoryPostProcessor extension point presentation] # postProcessBeanFactory End -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --"); System.out.println(); }}Copy the code

The extension point 3

Realize the BeanPostProcessor postProcessBeforeInitialization or postProcessAfterInitialization method

Timing: bean (postProcessBeforeInitialization) before initialization and initialized (postProcessAfterInitialization),Note that it must have been instantiated before initialization

@Configuration
public class BeanPostProcessPoint implements BeanPostProcessor {


   public BeanPostProcessPoint(a) {
      System.out.println();
      System.out.println("# # # # # # # # # # # # # # # # # # BeanPostProcessPoint constructor # # # # # # # # # # # # # # # # # #");
      System.out.println();
   }

   /** ** before the bean is initialized@param bean
    * @param beanName
    * @return
    * @throws BeansException
    */
   @Override
   public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
      /** * you can extend a bean here as needed */
      if (bean instanceof TestController) {
         System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [BeanPostProcessPoint] extension point # postProcessBeforeInitialization demonstration Start -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
         System.out.println("[BeanPostProcessPoint] extension point # postProcessBeforeInitialization demonstration, crurrentBeanName:" + beanName);
         System.out.println("This is only printed if the bean is a TestController otherwise the console will be full and you won't be able to see it.");
         System.out.println("After instantiation of the timing bean, before initialization");
         System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [BeanPostProcessPoint] extension point # postProcessBeforeInitialization demonstration End -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
         System.out.println();
      }
      return bean;
   }

   /** ** after the bean is initialized@param bean
    * @param beanName
    * @return
    * @throws BeansException
    */
   @Override
   public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
      /** * you can extend a bean here as needed */
      if (bean instanceof TestController) {
         System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [BeanPostProcessPoint] extension point # postProcessAfterInitialization demonstration Start -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
         System.out.println("[BeanPostProcessPoint] extension point # postProcessAfterInitialization demonstration, crurrentBeanName:" + beanName);
         System.out.println("This is only printed if the bean is a TestController otherwise the console will be full and you won't be able to see it.");
         System.out.println("After the timing bean is initialized");
         System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [BeanPostProcessPoint] extension point # postProcessAfterInitialization demonstration End -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
         System.out.println();
      }
      return bean;
   }



   / * this method of AbstractAutowireCapableBeanFactory protected Object initializeBean (String beanName, Object bean, @Nullable RootBeanDefinition mbd) { if (System.getSecurityManager() ! = null) { AccessController.doPrivileged(() -> { this.invokeAwareMethods(beanName, bean); return null; }, this.getAccessControlContext()); } else { this.invokeAwareMethods(beanName, bean); } Object wrappedBean = bean; if (mbd == null || ! mbd.isSynthetic()) { wrappedBean = this.applyBeanPostProcessorsBeforeInitialization(bean, beanName); } try { this.invokeInitMethods(beanName, wrappedBean, mbd); } catch (Throwable var6) { throw new BeanCreationException(mbd ! = null ? mbd.getResourceDescription() : null, beanName, "Invocation of init method failed", var6); } if (mbd == null || ! mbd.isSynthetic()) { wrappedBean = this.applyBeanPostProcessorsAfterInitialization(wrappedBean, beanName); } return wrappedBean; } public Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName) throws BeansException { Object result = existingBean; Object current; for(Iterator var4 = this.getBeanPostProcessors().iterator(); var4.hasNext(); result = current) { BeanPostProcessor processor = (BeanPostProcessor)var4.next(); current = processor.postProcessBeforeInitialization(result, beanName); / / TODO callback postProcessBeforeInitialization method postProcessAfterInitialization here just don't see the logic if (current = = null) {return result; } } return result; } * /
}
Copy the code

The extension point 4

Implement the afterPropertiesSet method of InitializingBean

Timing: Bean is instantiated and attribute assignment after he actually relationship with extension point 3 above is postProcessBeforeInitialization – > initializingBean – > postProcessAfterInitialization Understanding extension 3 will give you an idea of the timing of this

Note :afterPropertiesSet takes effect when the current class is instantiated, whereas BeanPostProcessor is all classes. This is why afterPropertiesSet functions have no arguments

@Component
public class InitializingBeanPoint implements InitializingBean {
   public InitializingBeanPoint(a) {
      System.out.println();
      System.out.println("# # # # # # # # # # # # # # # # # # InitializingBeanPoint constructor # # # # # # # # # # # # # # # # # #");
      System.out.println();
   }

   @Override
   public void afterPropertiesSet(a) throws Exception {
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [InitializingBeanPoint] extension point presentation # afterPropertiesSet start -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println("[InitializingBean] # afterPropertiesSet");
      System.out.println("Timing: after bean instantiation AbstractAutowireCapableBeanFactory initializeBean method of a class of invokeInitMethods (beanName wrappedBean, MBD);");
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [InitializingBeanPoint] extension point presentation # afterPropertiesSet end -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println();
   }

   / * this method of AbstractAutowireCapableBeanFactory protected Object initializeBean (String beanName, Object bean, @Nullable RootBeanDefinition mbd) { if (System.getSecurityManager() ! = null) { AccessController.doPrivileged(() -> { this.invokeAwareMethods(beanName, bean); return null; }, this.getAccessControlContext()); } else { this.invokeAwareMethods(beanName, bean); } Object wrappedBean = bean; if (mbd == null || ! mbd.isSynthetic()) { wrappedBean = this.applyBeanPostProcessorsBeforeInitialization(bean, beanName); } try { this.invokeInitMethods(beanName, wrappedBean, mbd); } catch (Throwable var6) { throw new BeanCreationException(mbd ! = null ? mbd.getResourceDescription() : null, beanName, "Invocation of init method failed", var6); } if (mbd == null || ! mbd.isSynthetic()) { wrappedBean = this.applyBeanPostProcessorsAfterInitialization(wrappedBean, beanName); } return wrappedBean; } protected void invokeInitMethods(String beanName, Object bean, @Nullable RootBeanDefinition mbd) throws Throwable { boolean isInitializingBean = bean instanceof InitializingBean; if (isInitializingBean && (mbd == null || ! mbd.isExternallyManagedInitMethod("afterPropertiesSet"))) { if (this.logger.isTraceEnabled()) { this.logger.trace("Invoking afterPropertiesSet() on bean with name '" + beanName + "'"); } if (System.getSecurityManager() ! = null) { try { AccessController.doPrivileged(() -> { ((InitializingBean)bean).afterPropertiesSet(); return null; }, this.getAccessControlContext()); } catch (PrivilegedActionException var6) { throw var6.getException(); } } else { ((InitializingBean)bean).afterPropertiesSet(); }} if (MBD! = null && bean.getClass() ! = NullBean.class) { String initMethodName = mbd.getInitMethodName(); if (StringUtils.hasLength(initMethodName) && (! isInitializingBean || !" afterPropertiesSet".equals(initMethodName)) && ! mbd.isExternallyManagedInitMethod(initMethodName)) { this.invokeCustomInitMethod(beanName, bean, mbd); }}} * /
}
Copy the code

The extension point 5

Initialize the method (method name is whatever you want) and then annotate it with @postConstruct or @PreDestroy

Timing: call (@PostConstruct); Call (@PreDestroy)

@Component
public class PostConstructPoint {

   public PostConstructPoint(a) {
      System.out.println();
      System.out.println("# # # # # # # # # # # # # # # # # # PostConstructPoint constructor # # # # # # # # # # # # # # # # # #");
      System.out.println();
   }

   @PostConstruct
   public void init(a){
      System.out.println();
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [PostConstructPoint] extension point demonstration @ PostConstruct start -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println("[PostConstructPoint Execution timing Demo]");
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [PostConstructPoint] extension point demonstration @ PostConstruct end -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println();
   }

   @PreDestroy
   public void destroy(a){
      System.out.println();
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [PostConstructPoint] extension point demonstration @ PreDestroy start -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println("[PostConstructPoint Execution timing Demo]");
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [PostConstructPoint] extension point demonstration @ PreDestroy end -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --"); System.out.println(); }}Copy the code

The extension point 6

The setBeanName method that implements BeanNameAware

  • Pay attention toFrom the source can be seen also can implement BeanClassLoaderAware setBeanClassLoader method, and beanClassAware setBeanFactory method

Timing: the bean is instantiated before it is initialized

@Component
public class BeanNameAwarePoint implements BeanNameAware {

   @Override
   public void setBeanName(String name) {
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- BeanNameAwarePoint # setBeanName start -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println([BeanNameAwarePoint] extension point demo # setBeanName name:+name);
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- BeanNameAwarePoint # setBeanName end -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println();
   }

/ * AbstractAutowireCapableBeanFactory class protected Object initializeBean (String beanName, Object bean, @Nullable RootBeanDefinition mbd) { if (System.getSecurityManager() ! = null) { AccessController.doPrivileged(() -> { this.invokeAwareMethods(beanName, bean); return null; }, this.getAccessControlContext()); } else { this.invokeAwareMethods(beanName, bean); } Object wrappedBean = bean; if (mbd == null || ! mbd.isSynthetic()) { wrappedBean = this.applyBeanPostProcessorsBeforeInitialization(bean, beanName); } try { this.invokeInitMethods(beanName, wrappedBean, mbd); } catch (Throwable var6) { throw new BeanCreationException(mbd ! = null ? mbd.getResourceDescription() : null, beanName, "Invocation of init method failed", var6); } if (mbd == null || ! mbd.isSynthetic()) { wrappedBean = this.applyBeanPostProcessorsAfterInitialization(wrappedBean, beanName); } return wrappedBean; } private void invokeAwareMethods(String beanName, Object bean) { if (bean instanceof Aware) { if (bean instanceof BeanNameAware) { ((BeanNameAware)bean).setBeanName(beanName); } if (bean instanceof BeanClassLoaderAware) {ClassLoader BCL = this.getBeanClassLoader(); if (bcl ! = null) { ((BeanClassLoaderAware)bean).setBeanClassLoader(bcl); }} if (bean instanceof beanClassAware) { ((BeanFactoryAware)bean).setBeanFactory(this); //TODO calls back to BeanFactoryAware's setBeanFactory method}}} */

}
Copy the code

The extension point 7

Implement CommandLineRunner's run method or ApplicationRunner's Run method

From the original code, you can see the order in which these two functions are called

Timing: After the container refresh is complete

  • Implement ApplicationRunner
@Component
public class ApplicationRunnerPoint implements ApplicationRunner {

   @Override
   public void run(ApplicationArguments args) throws Exception {
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [ApplicationRunnerPoint] extension point # demonstration run start -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println("[ApplicationRunnerPoint] # run ; "+"Timing: At this point the flush container is in the latter part of the run method and the run method will then issue the RUNNING event.");
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [ApplicationRunnerPoint] extension point # demonstration run end -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println();
   }
   Private void callRunners(ApplicationContext context, ApplicationArguments args) { List runners = new ArrayList(); runners.addAll(context.getBeansOfType(ApplicationRunner.class).values()); runners.addAll(context.getBeansOfType(CommandLineRunner.class).values()); AnnotationAwareOrderComparator.sort(runners); Iterator var4 = (new LinkedHashSet(runners)).iterator(); while(var4.hasNext()) { Object runner = var4.next(); if (runner instanceof ApplicationRunner) { this.callRunner((ApplicationRunner)runner, args); } if (runner instanceof CommandLineRunner) { this.callRunner((CommandLineRunner)runner, args); }}} * /
}
Copy the code
  • Implement CommandLineRunner
@Component
public class CommandLineRunnerPoint implements CommandLineRunner {
   @Override
   public void run(String... args) throws Exception {
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [CommandLineRunnerPoint] extension point # demonstration run start -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println("[CommandLineRunnerPoint] # run ; "+"Timing: At this point the flush container is in the latter part of the run method and the run method will then issue the RUNNING event.");
      System.out.println("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- [CommandLineRunnerPoint] extension point # demonstration run end -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --");
      System.out.println();
   }
   Private void callRunners(ApplicationContext context, ApplicationArguments args) { List runners = new ArrayList(); runners.addAll(context.getBeansOfType(ApplicationRunner.class).values()); runners.addAll(context.getBeansOfType(CommandLineRunner.class).values()); AnnotationAwareOrderComparator.sort(runners); Iterator var4 = (new LinkedHashSet(runners)).iterator(); while(var4.hasNext()) { Object runner = var4.next(); if (runner instanceof ApplicationRunner) { this.callRunner((ApplicationRunner)runner, args); } if (runner instanceof CommandLineRunner) { this.callRunner((CommandLineRunner)runner, args); }}} * /
}
Copy the code

Extension point 8

When a bean is destroyed (also an extension point)

@Component
public class DisposableBeanPoint implements DisposableBean {
   @Override
   public void destroy(a) throws Exception {
      System.out.println("[DisposableBeanPoint] DisposableBeanPoint"); }}Copy the code

The extension point 9

The implement of this a few methods of InstantiationAwareBeanPostProcessor

  • postProcessBeforeInitialization
  • postProcessAfterInitialization
  • postProcessBeforeInstantiation
  • postProcessAfterInstantiation
  • PostProcessPropertyValues (note that he has been marked as @ Deprecated) my he replaced by postProcessProperties springboot version

Found no InstantiationAwareBeanPostProcessor actually is also a BeanPostProcessor

@Component
public class InstantiationAwareBeanPostProcessorPoint implements InstantiationAwareBeanPostProcessor {
   @Override
   public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
// System.out.println("[InstantiationAwareBeanPostProcessorPoint] before initialization " + beanName);
      return bean;
   }

   @Override
   public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
// System.out.println("[InstantiationAwareBeanPostProcessorPoint] after initialization " + beanName);
      return bean;
   }

   @Override
   public Object postProcessBeforeInstantiation(Class
        beanClass, String beanName) throws BeansException {
// System.out.println("[InstantiationAwareBeanPostProcessorPoint] before instantiation " + beanName);
      return null;
   }

   @Override
   public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
// System.out.println("[InstantiationAwareBeanPostProcessorPoint] after instantiation " + beanName);
      return true;
   }

   @Override
   public PropertyValues postProcessPropertyValues(PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException {
// System.out.println("[InstantiationAwareBeanPostProcessorPoint] postProcessPropertyValues " + beanName);
      returnpvs; }}Copy the code
  • Note: we will not print this method because the console will be full of brushes if we print it. Here's how these methods work

InstantiationAwareBeanPostProcessor summary

  1. InstantiationAwareBeanPostProcessorInterface inheritanceBeanPostProcessorInterface, which internally provides three methods, plusBeanPostProcessor2 methods inside the interface, so implementing this interface requires implementing 5 methods.InstantiationAwareBeanPostProcessorThe main function of the interface lies in the things that need to be handled during the instantiation of the target object, including the process before and after the instantiation of the object and the setting of the properties of the instance
  2. PostProcessBeforeInstantiation (InstantiationAwareBeanPostProcessor own)Method is the first method to execute. It is called before the target object is instantiated. The return type of this method isObject, we can return any type of value. Since the target object is not instantiated at this time, the return value can be used instead of the instance of the target object (such as the proxy object) that should have been generated. If the method returns a value instead of the generated target object, onlypostProcessAfterInitializationMethods are called, and no other methods are called; Otherwise, follow the normal procedure
  3. PostProcessAfterInstantiation (InstantiationAwareBeanPostProcessor own)Method is called after the target object is instantiated, when the object has been instantiated but the instance’s properties have not yet been set and are null. If the method returns false, the property value is ignored; If true is returned, the property value is set as normal
  4. PostProcessPropertyValues (I this springboot version (2.1 x) has been replaced by postProcessProperties) (InstantiationAwareBeanPostProcessor own)Method to modify the property value (at this point the property value has not been set, but we can modify the property value that should have been set). ifpostProcessPropertiesMethod returns false and will not be called. Property values can be modified within this method
  5. The parent interfaceBeanPostProcessor2postProcessBeforeInitializationandpostProcessAfterInitializationIs after the object is instantiated (one is before initialization, one is called after initialization)
  6. InstantiationRepresents instantiation,InitializationIndicates initialization. Pre-instantiation means when the object is not yet created, and pre-initialization means when the object is already created but the property is not yet assigned

The extension point 10

  • Implement of the three methods of SmartInstantiationAwareBeanPostProcessor (actually more than three A total of eight) actually SmartInstantiationAwareBeanPostProcessor (own) three methods He was also inherited InstantiationAwareBeanPostProcessor (i.e., the extension points above 9 his own three methods) and InstantiationAwareBeanPostProcessor inherited BeanPostProcessor(own 2 methods)

So we say SmartInstantiationAwareBeanPostProcessor in fact there are eight ways to achieve this we only see SmartInstantiationAwareBeanPostProcessor own three methods

  • predictBeanType
  • determineCandidateConstructors
  • getEarlyBeanReference
@Component
public class SmartInstantiationAwareBeanPostProcessorPoint implements SmartInstantiationAwareBeanPostProcessor {


   @Override
   publicClass<? > predictBeanType(Class<? > beanClass, String beanName)throws BeansException {
// System.out.println("[SmartInstantiationAwareBeanPostProcessorPoint] predictBeanType " + beanName);
      return beanClass;
   }

   @Override
   publicConstructor<? >[] determineCandidateConstructors(Class<? > beanClass, String beanName)throws BeansException {
// System.out.println("[SmartInstantiationAwareBeanPostProcessorPoint] determineCandidateConstructors " + beanName);
      return null;
   }

   @Override
   public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException {
// System.out.println("[SmartInstantiationAwareBeanPostProcessorPoint] getEarlyBeanReference " + beanName);
      return bean;
   }

   / * this method predictBeanType AbstractAutowireCapableBeanFactory Class protected Class 
       predictBeanType(String beanName, RootBeanDefinition mbd, Class
      ... typesToMatch) { Class
       targetType = this.determineTargetType(beanName, mbd, typesToMatch); if (targetType ! = null && ! mbd.isSynthetic() && this.hasInstantiationAwareBeanPostProcessors()) { Iterator var5 = this.getBeanPostProcessors().iterator(); while(var5.hasNext()) { BeanPostProcessor bp = (BeanPostProcessor)var5.next(); if (bp instanceof SmartInstantiationAwareBeanPostProcessor) { SmartInstantiationAwareBeanPostProcessor ibp = (SmartInstantiationAwareBeanPostProcessor)bp; Class
       predicted = ibp.predictBeanType(targetType, beanName); if (predicted ! = null && (typesToMatch.length ! = 1 || FactoryBean.class ! = typesToMatch[0] || FactoryBean.class.isAssignableFrom(predicted))) { return predicted; } } } } return targetType; } * /

}
Copy the code
  • Note that this is the same as extension point 9 above and we will not print it. Here we summarize the functions of several methods of this extension point

SmartInstantiationAwareBeanPostProcessor summary

  1. SmartInstantiationAwareBeanPostProcessorInterface inheritanceInstantiationAwareBeanPostProcessorInterface, which internally provides three methods, plus five methods of the parent interface, so implementing this interface requires implementing eight methods.SmartInstantiationAwareBeanPostProcessorThe main function of the interface is also what needs to be handled during the instantiation of the target object. It is aInstantiationAwareBeanPostProcessorAn extension of the interface. Mainly in theSpringInternal use of frame
  2. predictBeanTypeThe method is used to predict the type of the Bean, returning the first Class type whose prediction succeeded, or null if the prediction failed. Lies mainly inBeanDefinitionUnable to determineBeanType is called to determine the type
  3. determineCandidateConstructorsThe method is used to select the appropriate constructor, for example, if a class has multiple constructors, and can be implemented to select the appropriate constructor and use it to instantiate the object. The methodIn postProcessBeforeInstantiationMethods andpostProcessAfterInstantiationMethod between calls, ifpostProcessBeforeInstantiationMethod returns a new instance in place of the one that was originally generated, then the method is ignored
  4. getEarlyBeanReferenceMainly used to solveCircular dependenciesThe problem. Such asReferenceAInside the instanceReferenceBThe reference,ReferenceBInside the instanceReferenceAThe reference. First, instantiateReferenceAPut this ahead of time after the instantiationbeanExposure to theObjectFactoryAnd thenpopulateProperty, which is found at this time requiredReferenceB. And then instantiate itReferenceBIn the instantiationReferenceBWhen it needs toReferenceATo continue, which is when it will goObjectFactoryFind out theReferenceAInstance,ReferenceBSmooth instantiation.ReferenceBAfter instantiation,The populate ReferenceAThe property process also completed successfully and was injectedReferenceBInstance. Take this ahead of timebeanExposure to theObjectFactoryIn theObjectFactoryThe obtained instance is passedgetEarlyBeanReferenceMethod derived
  • Here’s another picture of circular dependencies(Before you look at this picture, it's good to know about spring's level 1 cache, level 2 cache, and level 3 cache. I'm not going to go into too much detail here, but I'm going to write an article about it, but not yet.)

Please move on to the code sectionGithub.com/598572/xzll…

I’m just going to take the console output

  • Note that the output sequence shows when these extension points are called
/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/bin/java -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=53897:/Applications/IntelliJ IDEA.app/Contents/bin -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/lib/tools.jar:/Users/hzz/myself_project/xzll/study-admin/study-admin-service/target/classes:/Users/hzz/.m2/repository/org/mybatis/spring/boot/mybatis-spring-boot-starter/2.1.4/mybatis-spring-boot-starter-2.1.4.jar:/Users/hzz/.m2/repository/org/springframework/boot/spring-boot-starter/2.1.13.RELEASE/spring-boot-starter-2.1.13.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/boot/spring-boot/2.1.13.RELEASE/spring-boot-2.1.13.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.1.13.RELEASE/spring-boot-starter-logging-2.1.13.RELEASE.jar:/Users/hzz/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/hzz/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/hzz/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.11.2/log4j-to-slf4j-2.11.2.jar:/Users/hzz/.m2/repository/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar:/Users/hzz/.m2/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar:/Users/hzz/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/Users/hzz/.m2/repository/org/springframework/boot/spring-boot-starter-jdbc/2.1.13.RELEASE/spring-boot-starter-jdbc-2.1.13.RELEASE.jar:/Users/hzz/.m2/repository/com/zaxxer/HikariCP/3.2.0/HikariCP-3.2.0.jar:/Users/hzz/.m2/repository/org/springframework/spring-jdbc/5.1.9.RELEASE/spring-jdbc-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/2.1.4/mybatis-spring-boot-autoconfigure-2.1.4.jar:/Users/hzz/.m2/repository/org/mybatis/mybatis/3.5.6/mybatis-3.5.6.jar:/Users/hzz/.m2/repository/org/mybatis/mybatis-spring/2.0.6/mybatis-spring-2.0.6.jar:/Users/hzz/.m2/repository/mysql/mysql-connector-java/8.0.23/mysql-connector-java-8.0.23.jar:/Users/hzz/.m2/repository/com/github/pagehelper/pagehelper-spring-boot-starter/1.3.0/pagehelper-spring-boot-starter-1.3.0.jar:/Users/hzz/.m2/repository/com/github/pagehelper/pagehelper-spring-boot-autoconfigure/1.3.0/pagehelper-spring-boot-autoconfigure-1.3.0.jar:/Users/hzz/.m2/repository/com/github/pagehelper/pagehelper/5.2.0/pagehelper-5.2.0.jar:/Users/hzz/.m2/repository/com/github/jsqlparser/jsqlparser/3.2/jsqlparser-3.2.jar:/Users/hzz/.m2/repository/com/baomidou/mybatis-plus-boot-starter/3.4.3.1/mybatis-plus-boot-starter-3.4.3.1.jar:/Users/hzz/.m2/repository/com/baomidou/mybatis-plus/3.4.3.1/mybatis-plus-3.4.3.1.jar:/Users/hzz/.m2/repository/com/baomidou/mybatis-plus-extension/3.4.3.1/mybatis-plus-extension-3.4.3.1.jar:/Users/hzz/.m2/repository/com/baomidou/mybatis-plus-core/3.4.3.1/mybatis-plus-core-3.4.3.1.jar:/Users/hzz/.m2/repository/com/baomidou/mybatis-plus-annotation/3.4.3.1/mybatis-plus-annotation-3.4.3.1.jar:/Users/hzz/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.1.13.RELEASE/spring-boot-autoconfigure-2.1.13.RELEASE.jar:/Users/hzz/myself_project/xzll/study-common/target/classes:/Users/hzz/.m2/repository/org/springframework/boot/spring-boot-starter-aop/2.1.13.RELEASE/spring-boot-starter-aop-2.1.13.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-aop/5.1.9.RELEASE/spring-aop-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/org/aspectj/aspectjweaver/1.9.5/aspectjweaver-1.9.5.jar:/Users/hzz/myself_project/xzll/study-admin/study-admin-api/target/classes:/Users/hzz/.m2/repository/org/springframework/cloud/spring-cloud-starter-openfeign/2.1.5.RELEASE/spring-cloud-starter-openfeign-2.1.5.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/cloud/spring-cloud-openfeign-core/2.1.5.RELEASE/spring-cloud-openfeign-core-2.1.5.RELEASE.jar:/Users/hzz/.m2/repository/io/github/openfeign/form/feign-form-spring/3.8.0/feign-form-spring-3.8.0.jar:/Users/hzz/.m2/repository/io/github/openfeign/form/feign-form/3.8.0/feign-form-3.8.0.jar:/Users/hzz/.m2/repository/io/github/openfeign/feign-core/10.4.0/feign-core-10.4.0.jar:/Users/hzz/.m2/repository/io/github/openfeign/feign-slf4j/10.4.0/feign-slf4j-10.4.0.jar:/Users/hzz/.m2/repository/io/github/openfeign/feign-hystrix/10.4.0/feign-hystrix-10.4.0.jar:/Users/hzz/myself_project/xzll/study-starter/util/target/classes:/Users/hzz/myself_project/xzll/study-starter/pay/target/classes:/Users/hzz/.m2/repository/org/springframework/boot/spring-boot-starter-websocket/2.1.13.RELEASE/spring-boot-starter-websocket-2.1.13.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-messaging/5.1.9.RELEASE/spring-messaging-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-beans/5.1.9.RELEASE/spring-beans-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-websocket/5.1.9.RELEASE/spring-websocket-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-context/5.1.9.RELEASE/spring-context-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/com/alibaba/cloud/spring-cloud-starter-alibaba-nacos-config/2.1.4.RELEASE/spring-cloud-starter-alibaba-nacos-config-2.1.4.RELEASE.jar:/Users/hzz/.m2/repository/com/alibaba/spring/spring-context-support/1.0.10/spring-context-support-1.0.10.jar:/Users/hzz/.m2/repository/com/alibaba/nacos/nacos-client/1.4.1/nacos-client-1.4.1.jar:/Users/hzz/.m2/repository/com/alibaba/nacos/nacos-common/1.4.1/nacos-common-1.4.1.jar:/Users/hzz/.m2/repository/org/apache/httpcomponents/httpasyncclient/4.1.4/httpasyncclient-4.1.4.jar:/Users/hzz/.m2/repository/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar:/Users/hzz/.m2/repository/org/apache/httpcomponents/httpcore-nio/4.4.13/httpcore-nio-4.4.13.jar:/Users/hzz/.m2/repository/com/alibaba/nacos/nacos-api/1.4.1/nacos-api-1.4.1.jar:/Users/hzz/.m2/repository/io/prometheus/simpleclient/0.5.0/simpleclient-0.5.0.jar:/Users/hzz/.m2/repository/org/springframework/cloud/spring-cloud-commons/2.1.6.RELEASE/spring-cloud-commons-2.1.6.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/security/spring-security-crypto/5.1.6.RELEASE/spring-security-crypto-5.1.6.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/cloud/spring-cloud-context/2.1.6.RELEASE/spring-cloud-context-2.1.6.RELEASE.jar:/Users/hzz/.m2/repository/com/alibaba/cloud/spring-cloud-starter-alibaba-nacos-discovery/2.1.4.RELEASE/spring-cloud-starter-alibaba-nacos-discovery-2.1.4.RELEASE.jar:/Users/hzz/.m2/repository/com/alibaba/cloud/spring-cloud-alibaba-commons/2.1.4.RELEASE/spring-cloud-alibaba-commons-2.1.4.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/cloud/spring-cloud-starter-netflix-ribbon/2.1.5.RELEASE/spring-cloud-starter-netflix-ribbon-2.1.5.RELEASE.jar:/Users/hzz/.m2/repository/com/netflix/ribbon/ribbon/2.3.0/ribbon-2.3.0.jar:/Users/hzz/.m2/repository/com/netflix/ribbon/ribbon-transport/2.3.0/ribbon-transport-2.3.0.jar:/Users/hzz/.m2/repository/io/reactivex/rxnetty-contexts/0.4.9/rxnetty-contexts-0.4.9.jar:/Users/hzz/.m2/repository/io/reactivex/rxnetty-servo/0.4.9/rxnetty-servo-0.4.9.jar:/Users/hzz/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/Users/hzz/.m2/repository/io/reactivex/rxnetty/0.4.9/rxnetty-0.4.9.jar:/Users/hzz/.m2/repository/com/netflix/ribbon/ribbon-core/2.3.0/ribbon-core-2.3.0.jar:/Users/hzz/.m2/repository/com/netflix/ribbon/ribbon-httpclient/2.3.0/ribbon-httpclient-2.3.0.jar:/Users/hzz/.m2/repository/org/apache/httpcomponents/httpclient/4.5.11/httpclient-4.5.11.jar:/Users/hzz/.m2/repository/com/sun/jersey/jersey-client/1.19.1/jersey-client-1.19.1.jar:/Users/hzz/.m2/repository/com/sun/jersey/jersey-core/1.19.1/jersey-core-1.19.1.jar:/Users/hzz/.m2/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar:/Users/hzz/.m2/repository/com/sun/jersey/contribs/jersey-apache-client4/1.19.1/jersey-apache-client4-1.19.1.jar:/Users/hzz/.m2/repository/com/netflix/servo/servo-core/0.12.21/servo-core-0.12.21.jar:/Users/hzz/.m2/repository/com/netflix/netflix-commons/netflix-commons-util/0.3.0/netflix-commons-util-0.3.0.jar:/Users/hzz/.m2/repository/com/netflix/ribbon/ribbon-loadbalancer/2.3.0/ribbon-loadbalancer-2.3.0.jar:/Users/hzz/.m2/repository/com/netflix/netflix-commons/netflix-statistics/0.1.1/netflix-statistics-0.1.1.jar:/Users/hzz/.m2/repository/io/reactivex/rxjava/1.3.8/rxjava-1.3.8.jar:/Users/hzz/.m2/repository/org/springframework/cloud/spring-cloud-starter-netflix-hystrix/2.1.5.RELEASE/spring-cloud-starter-netflix-hystrix-2.1.5.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/cloud/spring-cloud-starter/2.1.6.RELEASE/spring-cloud-starter-2.1.6.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/security/spring-security-rsa/1.0.9.RELEASE/spring-security-rsa-1.0.9.RELEASE.jar:/Users/hzz/.m2/repository/org/bouncycastle/bcpkix-jdk15on/1.64/bcpkix-jdk15on-1.64.jar:/Users/hzz/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.64/bcprov-jdk15on-1.64.jar:/Users/hzz/.m2/repository/org/springframework/cloud/spring-cloud-netflix-hystrix/2.1.5.RELEASE/spring-cloud-netflix-hystrix-2.1.5.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/cloud/spring-cloud-netflix-ribbon/2.1.5.RELEASE/spring-cloud-netflix-ribbon-2.1.5.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/cloud/spring-cloud-netflix-archaius/2.1.5.RELEASE/spring-cloud-netflix-archaius-2.1.5.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/cloud/spring-cloud-starter-netflix-archaius/2.1.5.RELEASE/spring-cloud-starter-netflix-archaius-2.1.5.RELEASE.jar:/Users/hzz/.m2/repository/com/netflix/archaius/archaius-core/0.7.6/archaius-core-0.7.6.jar:/Users/hzz/.m2/repository/com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar:/Users/hzz/.m2/repository/commons-configuration/commons-configuration/1.8/commons-configuration-1.8.jar:/Users/hzz/.m2/repository/com/netflix/hystrix/hystrix-core/1.5.18/hystrix-core-1.5.18.jar:/Users/hzz/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar:/Users/hzz/.m2/repository/com/netflix/hystrix/hystrix-serialization/1.5.18/hystrix-serialization-1.5.18.jar:/Users/hzz/.m2/repository/com/fasterxml/jackson/module/jackson-module-afterburner/2.9.9/jackson-module-afterburner-2.9.9.jar:/Users/hzz/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/hzz/.m2/repository/com/netflix/hystrix/hystrix-metrics-event-stream/1.5.18/hystrix-metrics-event-stream-1.5.18.jar:/Users/hzz/.m2/repository/com/netflix/hystrix/hystrix-javanica/1.5.18/hystrix-javanica-1.5.18.jar:/Users/hzz/.m2/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar:/Users/hzz/.m2/repository/io/reactivex/rxjava-reactive-streams/1.2.1/rxjava-reactive-streams-1.2.1.jar:/Users/hzz/.m2/repository/org/reactivestreams/reactive-streams/1.0.3/reactive-streams-1.0.3.jar:/Users/hzz/.m2/repository/commons-cli/commons-cli/1.4/commons-cli-1.4.jar:/Users/hzz/.m2/repository/org/redisson/redisson/3.16.0/redisson-3.16.0.jar:/Users/hzz/.m2/repository/io/netty/netty-common/4.1.38.Final/netty-common-4.1.38.Final.jar:/Users/hzz/.m2/repository/io/netty/netty-codec/4.1.38.Final/netty-codec-4.1.38.Final.jar:/Users/hzz/.m2/repository/io/netty/netty-buffer/4.1.38.Final/netty-buffer-4.1.38.Final.jar:/Users/hzz/.m2/repository/io/netty/netty-transport/4.1.38.Final/netty-transport-4.1.38.Final.jar:/Users/hzz/.m2/repository/io/netty/netty-resolver/4.1.38.Final/netty-resolver-4.1.38.Final.jar:/Users/hzz/.m2/repository/io/netty/netty-resolver-dns/4.1.38.Final/netty-resolver-dns-4.1.38.Final.jar:/Users/hzz/.m2/repository/io/netty/netty-codec-dns/4.1.38.Final/netty-codec-dns-4.1.38.Final.jar:/Users/hzz/.m2/repository/io/netty/netty-handler/4.1.38.Final/netty-handler-4.1.38.Final.jar:/Users/hzz/.m2/repository/javax/cache/cache-api/1.1.1/cache-api-1.1.1.jar:/Users/hzz/.m2/repository/io/projectreactor/reactor-core/3.2.11.RELEASE/reactor-core-3.2.11.RELEASE.jar:/Users/hzz/.m2/repository/io/reactivex/rxjava3/rxjava/3.0.12/rxjava-3.0.12.jar:/Users/hzz/.m2/repository/org/jboss/marshalling/jboss-marshalling-river/2.0.11.Final/jboss-marshalling-river-2.0.11.Final.jar:/Users/hzz/.m2/repository/org/jboss/marshalling/jboss-marshalling/2.0.11.Final/jboss-marshalling-2.0.11.Final.jar:/Users/hzz/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/Users/hzz/.m2/repository/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar:/Users/hzz/.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.9.9/jackson-dataformat-yaml-2.9.9.jar:/Users/hzz/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.9/jackson-core-2.9.9.jar:/Users/hzz/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.9/jackson-databind-2.9.9.jar:/Users/hzz/.m2/repository/net/bytebuddy/byte-buddy/1.9.16/byte-buddy-1.9.16.jar:/Users/hzz/.m2/repository/org/jodd/jodd-bean/5.1.6/jodd-bean-5.1.6.jar:/Users/hzz/.m2/repository/org/jodd/jodd-core/5.1.6/jodd-core-5.1.6.jar:/Users/hzz/.m2/repository/io/springfox/springfox-swagger2/2.9.2/springfox-swagger2-2.9.2.jar:/Users/hzz/.m2/repository/io/swagger/swagger-annotations/1.5.20/swagger-annotations-1.5.20.jar:/Users/hzz/.m2/repository/io/swagger/swagger-models/1.5.20/swagger-models-1.5.20.jar:/Users/hzz/.m2/repository/io/springfox/springfox-spi/2.9.2/springfox-spi-2.9.2.jar:/Users/hzz/.m2/repository/io/springfox/springfox-core/2.9.2/springfox-core-2.9.2.jar:/Users/hzz/.m2/repository/io/springfox/springfox-schema/2.9.2/springfox-schema-2.9.2.jar:/Users/hzz/.m2/repository/io/springfox/springfox-swagger-common/2.9.2/springfox-swagger-common-2.9.2.jar:/Users/hzz/.m2/repository/io/springfox/springfox-spring-web/2.9.2/springfox-spring-web-2.9.2.jar:/Users/hzz/.m2/repository/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar:/Users/hzz/.m2/repository/org/springframework/plugin/spring-plugin-core/1.2.0.RELEASE/spring-plugin-core-1.2.0.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/plugin/spring-plugin-metadata/1.2.0.RELEASE/spring-plugin-metadata-1.2.0.RELEASE.jar:/Users/hzz/.m2/repository/org/mapstruct/mapstruct/1.2.0.Final/mapstruct-1.2.0.Final.jar:/Users/hzz/.m2/repository/io/springfox/springfox-swagger-ui/2.9.2/springfox-swagger-ui-2.9.2.jar:/Users/hzz/.m2/repository/com/google/guava/guava/20.0/guava-20.0.jar:/Users/hzz/.m2/repository/com/alibaba/druid/1.1.18/druid-1.1.18.jar:/Users/hzz/.m2/repository/org/freemarker/freemarker/2.3.30/freemarker-2.3.30.jar:/Users/hzz/.m2/repository/com/alibaba/easyexcel/2.2.6/easyexcel-2.2.6.jar:/Users/hzz/.m2/repository/org/apache/poi/poi/3.17/poi-3.17.jar:/Users/hzz/.m2/repository/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1.jar:/Users/hzz/.m2/repository/org/apache/poi/poi-ooxml/3.17/poi-ooxml-3.17.jar:/Users/hzz/.m2/repository/com/github/virtuald/curvesapi/1.04/curvesapi-1.04.jar:/Users/hzz/.m2/repository/org/apache/poi/poi-ooxml-schemas/3.17/poi-ooxml-schemas-3.17.jar:/Users/hzz/.m2/repository/org/apache/xmlbeans/xmlbeans/2.6.0/xmlbeans-2.6.0.jar:/Users/hzz/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar:/Users/hzz/.m2/repository/cglib/cglib/3.1/cglib-3.1.jar:/Users/hzz/.m2/repository/org/ehcache/ehcache/3.6.3/ehcache-3.6.3.jar:/Users/hzz/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.1.13.RELEASE/spring-boot-starter-web-2.1.13.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.1.13.RELEASE/spring-boot-starter-json-2.1.13.RELEASE.jar:/Users/hzz/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.9/jackson-datatype-jdk8-2.9.9.jar:/Users/hzz/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.9/jackson-datatype-jsr310-2.9.9.jar:/Users/hzz/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.9/jackson-module-parameter-names-2.9.9.jar:/Users/hzz/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.1.13.RELEASE/spring-boot-starter-tomcat-2.1.13.RELEASE.jar:/Users/hzz/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.31/tomcat-embed-core-9.0.31.jar:/Users/hzz/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.31/tomcat-embed-el-9.0.31.jar:/Users/hzz/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.31/tomcat-embed-websocket-9.0.31.jar:/Users/hzz/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.18.Final/hibernate-validator-6.0.18.Final.jar:/Users/hzz/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/Users/hzz/.m2/repository/org/jboss/logging/jboss-logging/3.3.3.Final/jboss-logging-3.3.3.Final.jar:/Users/hzz/.m2/repository/org/springframework/spring-web/5.1.9.RELEASE/spring-web-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-webmvc/5.1.9.RELEASE/spring-webmvc-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-expression/5.1.9.RELEASE/spring-expression-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-core/5.1.14.RELEASE/spring-core-5.1.14.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-jcl/5.1.9.RELEASE/spring-jcl-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/boot/spring-boot-starter-data-redis/2.1.13.RELEASE/spring-boot-starter-data-redis-2.1.13.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/data/spring-data-redis/2.1.10.RELEASE/spring-data-redis-2.1.10.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/data/spring-data-keyvalue/2.1.10.RELEASE/spring-data-keyvalue-2.1.10.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/data/spring-data-commons/2.1.10.RELEASE/spring-data-commons-2.1.10.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-tx/5.1.9.RELEASE/spring-tx-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-oxm/5.1.9.RELEASE/spring-oxm-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/org/springframework/spring-context-support/5.1.9.RELEASE/spring-context-support-5.1.9.RELEASE.jar:/Users/hzz/.m2/repository/io/lettuce/lettuce-core/5.1.8.RELEASE/lettuce-core-5.1.8.RELEASE.jar:/Users/hzz/.m2/repository/org/projectlombok/lombok/1.18.0/lombok-1.18.0.jar:/Users/hzz/.m2/repository/cn/hutool/hutool-all/5.6.6/hutool-all-5.6.6.jar:/Users/hzz/.m2/repository/com/alibaba/fastjson/1.2.46/fastjson-1.2.46.jar:/Users/hzz/.m2/repository/commons-fileupload/commons-fileupload/1.3.1/commons-fileupload-1.3.1.jar:/Users/hzz/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar:/Users/hzz/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/Users/hzz/.m2/repository/commons-codec/commons-codec/1.7/commons-codec-1.7.jar:/Users/hzz/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/Users/hzz/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar:/Users/hzz/.m2/repository/commons-net/commons-net/3.0/commons-net-3.0.jar:/Users/hzz/.m2/repository/org/apache/commons/commons-math3/3.2/commons-math3-3.2.jar:/Users/hzz/.m2/repository/commons-validator/commons-validator/1.4.0/commons-validator-1.4.0.jar:/Users/hzz/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar:/Users/hzz/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar:/Users/hzz/.m2/repository/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar:/Users/hzz/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar:/Users/hzz/.m2/repository/commons-pool/commons-pool/1.6/commons-pool-1.6.jar:/Users/hzz/.m2/repository/commons-io/commons-io/2.9.0/commons-io-2.9.0.jar:/Users/hzz/.m2/repository/org/apache/rocketmq/rocketmq-client/4.5.0/rocketmq-client-4.5.0.jar:/Users/hzz/.m2/repository/org/apache/rocketmq/rocketmq-common/4.5.0/rocketmq-common-4.5.0.jar:/Users/hzz/.m2/repository/org/apache/rocketmq/rocketmq-remoting/4.5.0/rocketmq-remoting-4.5.0.jar:/Users/hzz/.m2/repository/org/apache/rocketmq/rocketmq-logging/4.5.0/rocketmq-logging-4.5.0.jar:/Users/hzz/.m2/repository/io/netty/netty-tcnative-boringssl-static/2.0.29.Final/netty-tcnative-boringssl-static-2.0.29.Final.jar:/Users/hzz/.m2/repository/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar:/Users/hzz/.m2/repository/io/netty/netty-all/4.1.34.Final/netty-all-4.1.34.Final.jar com.xzll.test.StudyTestApplication

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v2.1.13.RELEASE)

2021-08-24 10:59:55.542  INFO 26950 --- [           main] c.a.n.c.c.impl.LocalConfigInfoProcessor  : LOCAL_SNAPSHOT_PATH:/Users/hzz/nacos/config
2021-08-24 10:59:55.569  INFO 26950 --- [           main] c.a.nacos.client.config.impl.Limiter     : limitTime:5.0
2021-08-24 10:59:55.595  INFO 26950 --- [           main] c.a.nacos.client.config.utils.JvmUtil    : isMultiInstance:false
2021-08-24 10:59:55.611  WARN 26950 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[study-admin-dev.properties] & group[study-admin]
2021-08-24 10:59:55.617  WARN 26950 --- [           main] c.a.c.n.c.NacosPropertySourceBuilder     : Ignore the empty nacos configuration and get it based on dataId[study-admin-dev-dev.properties] & group[study-admin]
2021-08-24 10:59:55.617  INFO 26950 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-study-admin-dev-dev.properties,study-admin'}, BootstrapPropertySource {name='bootstrapProperties-study-admin-dev.properties,study-admin'}, BootstrapPropertySource {name='bootstrapProperties-study-admin-dev,study-admin'}]
------------ApplicationContextInitializerPoint # initialize 开始-------------
[ApplicationContextInitializer扩展点演示] # initialize:  org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@53fd0d10, started on Thu Jan 01 08:00:00 CST 1970, parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@293a5bf6
BeanDefinitionCount count: 5
org.springframework.context.annotation.internalConfigurationAnnotationProcessor
org.springframework.context.annotation.internalAutowiredAnnotationProcessor
org.springframework.context.annotation.internalCommonAnnotationProcessor
org.springframework.context.event.internalEventListenerProcessor
org.springframework.context.event.internalEventListenerFactory
autoConfigurationReport
时机: run 方法中的 this.prepareContext(); 的时候
-------------ApplicationContextInitializerPoint # initialize 结束------------

2021-08-24 10:59:55.653  INFO 26950 --- [           main] com.xzll.test.StudyTestApplication       : The following profiles are active: dev
2021-08-24 10:59:56.395  INFO 26950 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2021-08-24 10:59:56.397  INFO 26950 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2021-08-24 10:59:56.424  INFO 26950 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 14ms. Found 0 repository interfaces.
-----------------------[BeanDefinitionRegistryPostProcessor扩展点演示] # postProcessBeanDefinitionRegistry 开始--------------------------------------
[BeanDefinitionRegistryPostProcessor扩展点演示] # postProcessBeanDefinitionRegistry
时机: refresh()的 this.invokeBeanFactoryPostProcessors(beanFactory); 方法中执行; 此时 bean的定义信息 都已经加载完毕 但是还没到实例化以及初始化阶段
-----------------------[BeanDefinitionRegistryPostProcessor扩展点演示] # postProcessBeanDefinitionRegistry 结束--------------------------------------

2021-08-24 10:59:56.613  INFO 26950 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=2ed4fa11-ed98-34ad-90e4-a628563a5b1a
-----------------------[BeanDefinitionRegistryPostProcessor扩展点演示] # postProcessBeanFactory 开始--------------------------------------
[BeanDefinitionRegistryPostProcessor扩展点演示] # postProcessBeanFactory
时机: refresh()的 this.invokeBeanFactoryPostProcessors(beanFactory); 方法中执行; 此时 bean的定义信息 都已经加载完毕 但是还没到实例化以及初始化阶段
-----------------------[BeanDefinitionRegistryPostProcessor扩展点演示] # postProcessBeanFactory 结束--------------------------------------

-----------------------[BeanFactoryPostProcessor扩展点演示] # postProcessBeanFactory 开始--------------------------------------
[BeanFactoryPostProcessor扩展点演示] # postProcessBeanFactory
时机: refresh()的 this.invokeBeanFactoryPostProcessors(beanFactory); 方法中执行; 此时 bean的定义信息 都已经加载完毕 但是还没到实例化以及初始化阶段
-----------------------[BeanFactoryPostProcessor扩展点演示] # postProcessBeanFactory 结束--------------------------------------

2021-08-24 10:59:56.696  INFO 26950 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$3f825871] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

################## BeanPostProcessPoint 的构造方法 ##################

2021-08-24 10:59:57.209  INFO 26950 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
2021-08-24 10:59:57.244  INFO 26950 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-08-24 10:59:57.245  INFO 26950 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.31]
2021-08-24 10:59:57.382  INFO 26950 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-08-24 10:59:57.382  INFO 26950 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1716 ms
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
     /               |         
                        3.4.3.1 

################## InitializingBeanPoint 的构造方法 ################## 

------------InitializingBeanPoint 实现 BeanNameAware # setBeanName 开始-------------
[InitializingBeanPoint 实现 BeanNameAware ]  扩展点演示 # setBeanName name: initializingBeanPoint
------------InitializingBeanPoint 实现 BeanNameAware # setBeanName 结束-------------

-----------------------[BeanPostProcessPoint]  扩展点演示 # postProcessBeforeInitialization  开始--------------------------------------
[BeanPostProcessPoint]  扩展点演示 # postProcessBeforeInitialization , crurrentBeanName: initializingBeanPoint
这里只有当bean是 InitializingBeanPoint 时候才打印 否则的话控制台要爆满了 根本看不清,另外也是为了好和BeanNameAware以及InitializingBean做比较 
时机 bean实例化后,初始化之前
-----------------------[BeanPostProcessPoint]  扩展点演示 # postProcessBeforeInitialization  结束--------------------------------------

-----------------------[InitializingBeanPoint]  扩展点演示 # afterPropertiesSet  开始--------------------------------------
[BeanNameAwarePoint] # afterPropertiesSet
时机: bean实例化后 AbstractAutowireCapableBeanFactory 类的 initializeBean方法 中的 invokeInitMethods(beanName, wrappedBean, mbd);
-----------------------[InitializingBeanPoint]  扩展点演示 # afterPropertiesSet  结束--------------------------------------

-----------------------[BeanPostProcessPoint]  扩展点演示 # postProcessAfterInitialization  开始--------------------------------------
[BeanPostProcessPoint]  扩展点演示 # postProcessAfterInitialization , crurrentBeanName: initializingBeanPoint
这里只有当bean是 InitializingBeanPoint 时候才打印 否则的话控制台要爆满了 根本看不清,另外也是为了好和BeanNameAware以及InitializingBean做比较 
时机 bean初始化后
-----------------------[BeanPostProcessPoint]  扩展点演示 # postProcessAfterInitialization  结束--------------------------------------


################## PostConstructPoint的构造方法 ################## 


-----------------------[PostConstructPoint]  扩展点演示 @PostConstruct 开始--------------------------------------
[PostConstructPoint执行时机演示]
-----------------------[PostConstructPoint]  扩展点演示 @PostConstruct 结束--------------------------------------

2021-08-24 11:00:13.728  INFO 26950 --- [           main] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2021-08-24 11:00:13.945  INFO 26950 --- [           main] org.redisson.Version                     : Redisson 3.16.0
2021-08-24 11:00:19.176  INFO 26950 --- [sson-netty-4-13] o.r.c.pool.MasterPubSubConnectionPool    : 1 connections initialized for 127.0.0.1/127.0.0.1:6379
2021-08-24 11:00:19.225  INFO 26950 --- [sson-netty-4-19] o.r.c.pool.MasterConnectionPool          : 24 connections initialized for 127.0.0.1/127.0.0.1:6379
2021-08-24 11:00:19.350  WARN 26950 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2021-08-24 11:00:19.350  INFO 26950 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2021-08-24 11:00:19.354  WARN 26950 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2021-08-24 11:00:19.354  INFO 26950 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2021-08-24 11:00:19.632  INFO 26950 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-08-24 11:00:19.889  INFO 26950 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService 'Nacos-Watch-Task-Scheduler'
2021-08-24 11:00:20.335  WARN 26950 --- [           main] o.s.b.a.f.FreeMarkerAutoConfiguration    : Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false)
2021-08-24 11:00:20.815  INFO 26950 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Property :null
2021-08-24 11:00:20.816  INFO 26950 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Environment :null
2021-08-24 11:00:20.816  INFO 26950 --- [           main] com.alibaba.nacos.client.naming          : initializer namespace from System Property :null
2021-08-24 11:00:25.923  INFO 26950 --- [           main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2021-08-24 11:00:25.940  INFO 26950 --- [           main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
2021-08-24 11:00:26.098  INFO 26950 --- [           main] s.d.s.w.s.ApiListingReferenceScanner     : Scanning for api listing references
2021-08-24 11:00:26.225  INFO 26950 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
2021-08-24 11:00:26.227  INFO 26950 --- [           main] com.alibaba.nacos.client.naming          : [BEAT] adding beat: BeatInfo{port=8081, ip='192.168.31.23', weight=1.0, serviceName='study-test@@study-admin', cluster='DEFAULT', metadata={preserved.register.source=SPRING_CLOUD}, scheduled=false, period=5000, stopped=false} to beat map.
2021-08-24 11:00:26.228  INFO 26950 --- [           main] com.alibaba.nacos.client.naming          : [REGISTER-SERVICE] 932a9da5-fdd6-4747-bc13-a3e97b089281 registering service study-test@@study-admin with instance: Instance{instanceId='null', ip='192.168.31.23', port=8081, weight=1.0, healthy=true, enabled=true, ephemeral=true, clusterName='DEFAULT', serviceName='null', metadata={preserved.register.source=SPRING_CLOUD}}
2021-08-24 11:00:26.235  INFO 26950 --- [           main] c.a.c.n.registry.NacosServiceRegistry    : nacos registry, study-test study-admin 192.168.31.23:8081 register finished
2021-08-24 11:00:26.240  INFO 26950 --- [           main] com.xzll.test.StudyTestApplication       : Started StudyTestApplication in 41.351 seconds (JVM running for 46.824)
-----------------------[ApplicationRunnerPoint]  扩展点演示 # run  开始--------------------------------------
[ApplicationRunnerPoint] # run ; 时机:此时已经刷新容器处于run方法的后半部分了 接下来run方法将发布running事件
-----------------------[ApplicationRunnerPoint]  扩展点演示 # run  结束--------------------------------------

-----------------------[CommandLineRunnerPoint]  扩展点演示 # run  开始--------------------------------------
[CommandLineRunnerPoint] # run ; 时机:此时已经刷新容器处于run方法的后半部分了 接下来run方法将发布running事件
-----------------------[CommandLineRunnerPoint]  扩展点演示 # run  结束--------------------------------------

2021-08-24 11:00:26.245  INFO 26950 --- [           main] c.a.n.client.config.impl.ClientWorker    : [fixed-127.0.0.1_8848-f407f750-961e-44f2-80d7-6983374ad1e0] [subscribe] study-admin-dev+study-admin+f407f750-961e-44f2-80d7-6983374ad1e0
2021-08-24 11:00:26.246  INFO 26950 --- [           main] c.a.nacos.client.config.impl.CacheData   : [fixed-127.0.0.1_8848-f407f750-961e-44f2-80d7-6983374ad1e0] [add-listener] ok, tenant=f407f750-961e-44f2-80d7-6983374ad1e0, dataId=study-admin-dev, group=study-admin, cnt=1
2021-08-24 11:00:26.246  INFO 26950 --- [           main] c.a.n.client.config.impl.ClientWorker    : [fixed-127.0.0.1_8848-f407f750-961e-44f2-80d7-6983374ad1e0] [subscribe] study-admin-dev.properties+study-admin+f407f750-961e-44f2-80d7-6983374ad1e0
2021-08-24 11:00:26.246  INFO 26950 --- [           main] c.a.nacos.client.config.impl.CacheData   : [fixed-127.0.0.1_8848-f407f750-961e-44f2-80d7-6983374ad1e0] [add-listener] ok, tenant=f407f750-961e-44f2-80d7-6983374ad1e0, dataId=study-admin-dev.properties, group=study-admin, cnt=1
2021-08-24 11:00:26.246  INFO 26950 --- [           main] c.a.n.client.config.impl.ClientWorker    : [fixed-127.0.0.1_8848-f407f750-961e-44f2-80d7-6983374ad1e0] [subscribe] study-admin-dev-dev.properties+study-admin+f407f750-961e-44f2-80d7-6983374ad1e0
2021-08-24 11:00:26.246  INFO 26950 --- [           main] c.a.nacos.client.config.impl.CacheData   : [fixed-127.0.0.1_8848-f407f750-961e-44f2-80d7-6983374ad1e0] [add-listener] ok, tenant=f407f750-961e-44f2-80d7-6983374ad1e0, dataId=study-admin-dev-dev.properties, group=study-admin, cnt=1
2021-08-24 11:00:26.445  INFO 26950 --- [g.push.receiver] com.alibaba.nacos.client.naming          : received push data: {"type":"dom","data":"{\"name\":\"study-test@@study-admin\",\"clusters\":\"DEFAULT\",\"cacheMillis\":10000,\"hosts\":[{\"instanceId\":\"192.168.31.23#8081#DEFAULT#study-test@@study-admin\",\"ip\":\"192.168.31.23\",\"port\":8081,\"weight\":1.0,\"healthy\":true,\"enabled\":true,\"ephemeral\":true,\"clusterName\":\"DEFAULT\",\"serviceName\":\"study-test@@study-admin\",\"metadata\":{\"preserved.register.source\":\"SPRING_CLOUD\"},\"instanceHeartBeatInterval\":5000,\"ipDeleteTimeout\":30000,\"instanceHeartBeatTimeOut\":15000}],\"lastRefTime\":1629774026443,\"checksum\":\"\",\"allIPs\":false,\"reachProtectionThreshold\":false,\"valid\":true}","lastRefTime":369116050320926} from /192.168.31.23
2021-08-24 11:00:26.459  INFO 26950 --- [g.push.receiver] com.alibaba.nacos.client.naming          : new ips(1) service: study-test@@study-admin@@DEFAULT -> [{"instanceId":"192.168.31.23#8081#DEFAULT#study-test@@study-admin","ip":"192.168.31.23","port":8081,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"study-test@@study-admin","metadata":{"preserved.register.source":"SPRING_CLOUD"},"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]
2021-08-24 11:00:26.466  INFO 26950 --- [g.push.receiver] com.alibaba.nacos.client.naming          : current ips:(1) service: study-test@@study-admin@@DEFAULT -> [{"instanceId":"192.168.31.23#8081#DEFAULT#study-test@@study-admin","ip":"192.168.31.23","port":8081,"weight":1.0,"healthy":true,"enabled":true,"ephemeral":true,"clusterName":"DEFAULT","serviceName":"study-test@@study-admin","metadata":{"preserved.register.source":"SPRING_CLOUD"},"instanceHeartBeatInterval":5000,"instanceHeartBeatTimeOut":15000,"ipDeleteTimeout":30000}]
Copy the code

In this paper, the ~ ~ ~