外贸网站定制制作公司,网络软件下载,网站网站设计网站,上海电子网站建设1.configuration是component的内部类#xff0c;configuration包含component注解。 2.configuration中所有带Bean都会被CGLIB动态代理#xff0c;调用此配置类中的方法都会返回同一个实例。component不会被代理#xff0c;调用配置类中的方法都会新建一个实例。 3.configura… 1.configuration是component的内部类configuration包含component注解。 2.configuration中所有带Bean都会被CGLIB动态代理调用此配置类中的方法都会返回同一个实例。component不会被代理调用配置类中的方法都会新建一个实例。 3.configuration标注的类要求 1.必须是类不可以是工厂返回的实例不能是final类final不可CGLIB动态代理 2.配置类不可以是native方法 3.嵌套配置类需要声明为static 4.Bean方法不会进一步反过来创建配置类即便有configuration只会作为不同的Bean
加载流程
1.再springboot程序run方法中有个refreshcontext()的refresh()
2.obtainFreshBeanFactory 将ConfigurationClassPostProcessor 注册到beanDefinition中
3.invokeBeanFactoryPostProcessors 实例化ConfigurationClassPostProcessor 将配置类带configuration的配置类添加标志位FULLcomponent、ComponentScan添加Lite。
4.通过invokeBeanFactoryPostProcessors将FULL的配置类通过Enhancer再字节码层面生成CGLIB子类替换原来的Bean方法。
5.finishBeanFactoryInitialization实例化非懒加载对象。