spring的bean层次性依赖查找和延迟依赖查找

•层次性依赖查找接口-HierarchicalBeanFactory

       •双亲BeanFactory:getParentBeanFactory()  与之对应的ConfigableBeanFactory#setParentBeanFactory()

       •层次性查找

             •根据Bean 名称查找

                    •基于containsLocalBean 方法实现

             •根据Bean 类型查找实例列表

                     •单一类型:BeanFactoryUtils#beanOfType

                     •集合类型:BeanFactoryUtils#beansOfTypeIncludingAncestors

            •根据Java 注解查找名称列表

                     •BeanFactoryUtils#beanNamesForTypeIncludingAncestors

延迟依赖查找

•Bean 延迟依赖查找接口

       •org.springframework.beans.factory.ObjectFactory

       •org.springframework.beans.factory.ObjectProvider  implements Iterator

              •Spring 5 对Java 8 特性扩展

                   •函数式接口

                          •getIfAvailable(Supplier)

                          •ifAvailable(Consumer)

                  •Stream 扩展-stream()

你可能感兴趣的:(spring,data,springboot)