A brief introduction to BeanFactory inheritance
1. BeanDefinitionRegistry registry
Each node element in the Spring configuration file is represented in the Spring container by a BeanDefinition object, which describes the Bean’s configuration information. The BeanDefinitionRegistry interface provides methods for manually registering BeanDefinition objects with containers.
2.BeanFactory Top-level interface
At the top of the class structure tree, its main method is getBean(String beanName), which returns a Bean with a specific name from the container. The functionality of BeanFactory is extended through other interfaces.
3.ListableBeanFactory
This interface defines several methods to access basic information about beans in a container, such as viewing the number of beans, getting the configuration name of a Bean of a certain type, and viewing whether a Bean is included in the container.
4. Father and son HierarchicalBeanFactory cascade
The interface of the parent-child IoC container, the child container can access the parent container through the interface method; HierarchicalBeanFactory Interface, Spring’s IoC container can establish a parent-child hierarchy of containers that can access beans in the parent, but the parent can’t access beans in the child. Spring uses parent-child containers to implement many functions, such as in Spring MVC, presentation layer beans are in a child container, while business layer and persistence layer beans are in the parent container. In this way, presentation layer beans can reference business layer and persistence layer beans, while business layer and persistence layer beans cannot see presentation layer beans.
5.ConfigurableBeanFactory
Is an important interface that enhances the customizability of the IoC container, defining methods for setting class loaders, property editors, post-container initialization handlers, and so on.
6. AutowireCapableBeanFactory automatic assembly
Defines methods for automating assembly of beans in containers according to certain rules, such as matching by name, matching by type, and so on.
7. Register singleton beans during the SingletonBeanRegistry run
Defines methods that allow singleton beans to be registered with the container at run time; For singleton beans, the BeanFactory caches the Bean instance, so the second time you use getBean() to fetch the Bean instance directly from the IoC container’s cache. Spring DefaultSingletonBeanRegistry class provides a used to slow the CDS instance Bean cache, it is a HashMap with the cache, Single-instance beans are stored in the HashMap with a beanName key.