AutowireCapableBeanFactory實現了BeanFactory接口,負責bean生命週期的管理。咱們先看看幾個常量segmentfault
int AUTOWIRE_NO = 0;//表示沒有外部定義的自動裝配 int AUTOWIRE_BY_NAME = 1;//經過名稱指示自動裝配bean屬性(適用於Bean全部屬性的setter) int AUTOWIRE_BY_TYPE = 2;//經過類型指示自動裝配bean屬性(適用於Bean全部屬性的setter) int AUTOWIRE_CONSTRUCTOR = 3;//構造函數 int AUTOWIRE_AUTODETECT = 4;//經過bean類的內省肯定適當的自動裝配策略,已棄用 String ORIGINAL_INSTANCE_SUFFIX = ".ORIGINAL";//用於沒有代理的時候,也能強制返回實例
bean的建立app
//autowireMode就是上面的常量,dependencyCheck是否對依賴進行檢查 Object createBean(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException; <T> T createBean(Class<T> beanClass) throws BeansException;
bean的初始化函數
Object initializeBean(Object existingBean, String beanName) throws BeansException;
bean的後置處理器ui
Object applyBeanPostProcessorsAfterInitialization(Object existingBean, String beanName) throws BeansException; Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName) throws BeansException;
bean的銷燬spa
void destroyBean(Object existingBean);
自動裝配bean代理
Object autowire(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException; void autowireBean(Object existingBean) throws BeansException; void autowireBeanProperties(Object existingBean, int autowireMode, boolean dependencyCheck) throws BeansException;
配置beancode
Object configureBean(Object existingBean, String beanName) throws BeansException;
解析beanblog
Object resolveBeanByName(String name, DependencyDescriptor descriptor) throws BeansException; Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName) throws BeansException; Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName, @Nullable Set<String> autowiredBeanNames, @Nullable TypeConverter typeConverter) throws BeansException; <T> NamedBeanHolder<T> resolveNamedBean(Class<T> requiredType) throws BeansException;