第15集 BeanPostProcessor、BeanFactroyPostProcessor
【视频来源于:B站up主孙帅suns Spring源码视频】
1、Spring预先给我们提供的PostProcessor的有哪些 是怎么来的?


2、Spirng中非常重要的扩展点
- BeanPostProcessor 和BeanFactoryPostProcesor
- AutowiredAnnotationBeanPostProcessor
- BeanFactoryPostProcesor有个子接口BeanDefinitionRegistryPostProcessor
3、BeanFactoryPostProcesor和BeanFactoryPostProcesor的区别
BeanPostProcessor处理的是对象
BeanFactoryPostProcesor处理的是BeanDefintion

4、BeanFactroyPostProcessor实践

注意@Component的BeanFactroyPostProcessor直接使用
5、ConfigurationClassPostProcessor的作用
作用:处理 @Configuration 注解 —> @Bean
@ComponentScan 包扫描
@Import 1 注册普通类 2 importSelect 3 importBeanDefinitionRegister
@ImportResource
6、ImportResource应用场景
- 遗留系统的处理
-
- SpringBoot事务纯注解
- 使用注解处理事务冗余太多了
-
- 这样带来的好处就是减少冗余
-
- 使用注解处理事务冗余太多了
7、AutowiredAnnotationBeanPostProcessor的作用
作用 @Autowired @Value @Inject
8、CommonAnnotationBeanPostProcessor 的作用
- @Resource
- @PostConstruct
- init-method
- InitializingBean
- @PreDestory
- destroy-method
- DisposableBean
9、AnnotationConfigApplicationContext和ClassPathXmlApplicationContext区别
AnnotationConfigApplicationContext处理的是注解
ClassPathXmlApplicationContext处理的是xml
10、Spring架构特别牛是如何体现的?
ClassPathXmlApplicationContext比AnnotationConfigApplicationContext诞生的早,
AnnotationConfigApplicationContext对ClassPathXmlApplicationContext进行了扩展,
但是它这个扩展没有动任何源码,都是通过BeanPostProcessor来加工的,对现有的体系一点儿都没动,
通过Processor对对象做加工,对BD做加工,融入进去,这是Spring设计特别华丽的地方,不需要改代码,无缝对接。