AutowireCapableBeanFactory接口方法详解

1、 T createBean(Class beanClass) throws BeansException;

  Fully create a new bean instance of the given class.
  由某类型的.class创造一个bean。


2、void autowireBean(Object existingBean) throws BeansException;

  Populate the given bean instance through applying after-instantiation callbacks and bean property post-processing (e.g. for annotation-driven injection).
  在bean实例化和属性设置完毕之后,填充对应的bean instance


3、Object configureBean(Object existingBean, String beanName) throws BeansException;

  Configure the given raw bean: autowiring bean properties, applying bean property values, applying factory callbacks such as setBeanName and setBeanFactory, and also applying all bean post processors (including ones which might wrap the given raw bean).
  配置参数中给出的raw bean,自动配置bean的属性,包括对属性赋值,设置好工厂类的回调函数(setBeanName、SetBeanFactory)。还有就是调用所有的post processors(包括那些对raw bean的包装操作)


4、Object createBean(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;

  Fully create a new bean instance of the given class with the specified autowire strategy. All constants defined in this interface are supported here.
  Performs full initialization of the bean, including all applicable BeanPostProcessors. This is effectively a superset of what autowire provides, adding initializeBean behavior.
  这是创建一个新的bean 实例的整个操作过程,参数描述了新的bean的class和其配置策略。在这个interface中定义的所有的常量,在这个方法中都可以使用。
  初始化一个bean的整个过程,包括所有可以适用的BeanPostProcessors。这是一个有效的***(最后一句真的不会翻译了)


5、Object autowire(Class beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;

  Instantiate a new bean instance of the given class with the specified autowire strategy. All constants defined in this interface are supported here. Can also be invoked with AUTOWIRE_NO in order to just apply before-instantiation callbacks (e.g. for annotation-driven injection).
  Does not apply standard BeanPostProcessors callbacks or perform any further initialization of the bean. This interface offers distinct, fine-grained operations for those purposes, for example initializeBean. However, InstantiationAwareBeanPostProcessor callbacks are applied, if applicable to the construction of the instance.
  根据参数中指定的autowire(注入)方式,实例化一个由参数中类的新的bean。可以使用这个借口中定义的所有常量。还可以在回调之前用AUTOWIRE_NO为顺序来调用。
  对一个bean不用标准的BeanPostProcessors回调方法或者实现更多的初始化操作。这个为这个目的接口提供独特的细粒度的操作方法,举个初始化bean的例子来说,如果一个实例适用,就调用InstantiationAwareBeanPostProcessor。


6、void autowireBeanProperties(Object existingBean, int autowireMode, boolean dependencyCheck) throws BeansException;

  Autowire the bean properties of the given bean instance by name or type. Can also be invoked with AUTOWIRE_NO in order to just apply after-instantiation callbacks (e.g. for annotation-driven injection).
  根据名字或者类型自动注入参数中指定的bean实例的属性。同时可以由AUTOWIRE_NO来对实例化后回调进行排序。


7、void applyBeanPropertyValues(Object existingBean, String beanName) throws BeansException;

  Apply the property values of the bean definition with the given name to the given bean instance. The bean definition can either define a fully self-contained bean, reusing its property values, or just property values meant to be used for existing bean instances.
  对由名字和bean实例指定的bean进行属性复制操作。bean定义的属性可以是单独使用、重复使用、或者是属性值表示bean实例可以使用。


未完待续。。。

你可能感兴趣的:(AutowireCapableBeanFactory接口方法详解)