AutowireCapableBeanFactory源碼

import java.util.Set;

import org.springframework.beans.BeansException;
import org.springframework.beans.TypeConverter;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.lang.Nullable;

/**
 * Extension of the {@link org.springframework.beans.factory.BeanFactory}
 * interface to be implemented by bean factories that are capable of
 * autowiring, provided that they want to expose this functionality for
 * existing bean instances.
 *
 * <p>This subinterface of BeanFactory is not meant to be used in normal
 * application code: stick to {@link org.springframework.beans.factory.BeanFactory}
 * or {@link org.springframework.beans.factory.ListableBeanFactory} for
 * typical use cases.
 *
 * <p>Integration code for other frameworks can leverage this interface to
 * wire and populate existing bean instances that Spring does not control
 * the lifecycle of. This is particularly useful for WebWork Actions and
 * Tapestry Page objects, for example.
 *
 * <p>Note that this interface is not implemented by
 * {@link org.springframework.context.ApplicationContext} facades,
 * as it is hardly ever used by application code. That said, it is available
 * from an application context too, accessible through ApplicationContext's
 * {@link org.springframework.context.ApplicationContext#getAutowireCapableBeanFactory()}
 * method.
 *
 * <p>You may also implement the {@link org.springframework.beans.factory.BeanFactoryAware}
 * interface, which exposes the internal BeanFactory even when running in an
 * ApplicationContext, to get access to an AutowireCapableBeanFactory:
 * simply cast the passed-in BeanFactory to AutowireCapableBeanFactory.
 *
 * @author Juergen Hoeller
 * @since 04.12.2003
 * @see org.springframework.beans.factory.BeanFactoryAware
 * @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory
 * @see org.springframework.context.ApplicationContext#getAutowireCapableBeanFactory()
 */

//通過上面注釋信息可以得知這個接口類是創(chuàng)建Bean的Bean工程的拓展類蹈丸,全中文名為自動裝配Bean工程
//其作用為注冊進Bean工廠的數據自動裝配回右,該接口類中提供了各種自動裝配Bean實例的常量等..可以根據
//不同方式來裝配Bean

public interface AutowireCapableBeanFactory extends BeanFactory {

    /**
     * Constant that indicates no externally defined autowiring. Note that
     * BeanFactoryAware etc and annotation-driven injection will still be applied.
     * @see #createBean
     * @see #autowire
     * @see #autowireBeanProperties
     */
 /**
     * 常量锯仪,用于標識外部自動裝配功能是否可用齐媒。但是此標識不影響正常的(基于注解的等)自動裝配功能的使用
     */
    int AUTOWIRE_NO = 0;

    /**
     * Constant that indicates autowiring bean properties by name
     * (applying to all bean property setters).
     * @see #createBean
     * @see #autowire
     * @see #autowireBeanProperties
     */
        //根據名稱自動裝配Bean
    int AUTOWIRE_BY_NAME = 1;

    /**
     * Constant that indicates autowiring bean properties by type
     * (applying to all bean property setters).
     * @see #createBean
     * @see #autowire
     * @see #autowireBeanProperties
     */
        //根據類型裝配Bean
    int AUTOWIRE_BY_TYPE = 2;

    /**
     * Constant that indicates autowiring the greediest constructor that
     * can be satisfied (involves resolving the appropriate constructor).
     * @see #createBean
     * @see #autowire
     */
      //可用于構造器的Bean裝配
    int AUTOWIRE_CONSTRUCTOR = 3;

    /**
     * Constant that indicates determining an appropriate autowire strategy
     * through introspection of the bean class.
     * @see #createBean
     * @see #autowire
     * @deprecated as of Spring 3.0: If you are using mixed autowiring strategies,
     * prefer annotation-based autowiring for clearer demarcation of autowiring needs.
     */
        //標識按照貪婪策略匹配出的最符合的構造方法來自動裝配的常量
    @Deprecated
    int AUTOWIRE_AUTODETECT = 4;

    /**
     * Suffix for the "original instance" convention when initializing an existing
     * bean instance: to be appended to the fully-qualified bean class name,
     * e.g. "com.mypackage.MyClass.ORIGINAL", in order to enforce the given instance
     * to be returned, i.e. no proxies etc.
     * @since 5.1
     * @see #initializeBean(Object, String)
     * @see #applyBeanPostProcessorsBeforeInitialization(Object, String)
     * @see #applyBeanPostProcessorsAfterInitialization(Object, String)
     */
        //根據約定的后綴來裝配Bean
    String ORIGINAL_INSTANCE_SUFFIX = ".ORIGINAL";


    //-------------------------------------------------------------------------
    // Typical methods for creating and populating external bean instances
    //-------------------------------------------------------------------------

    /**
     * Fully create a new bean instance of the given class.
     * <p>Performs full initialization of the bean, including all applicable
     * {@link BeanPostProcessor BeanPostProcessors}.
     * <p>Note: This is intended for creating a fresh instance, populating annotated
     * fields and methods as well as applying all standard bean initialization callbacks.
     * It does <i>not</i> imply traditional by-name or by-type autowiring of properties;
     * use {@link #createBean(Class, int, boolean)} for those purposes.
     * @param beanClass the class of the bean to create
     * @return the new bean instance
     * @throws BeansException if instantiation or wiring failed
     */
        //具備注解方式創(chuàng)建Bean
        //表明這是用于創(chuàng)建Bean實例箭养,但是不具備自動裝配涎跨,如果創(chuàng)建失敗則拋出BeansException異常
    <T> T createBean(Class<T> beanClass) throws BeansException;

    /**
     * Populate the given bean instance through applying after-instantiation callbacks
     * and bean property post-processing (e.g. for annotation-driven injection).
     * <p>Note: This is essentially intended for (re-)populating annotated fields and
     * methods, either for new instances or for deserialized instances. It does
     * <i>not</i> imply traditional by-name or by-type autowiring of properties;
     * use {@link #autowireBeanProperties} for those purposes.
     * @param existingBean the existing bean instance
     * @throws BeansException if wiring failed
     */
        //表明主要是用于處理Bean中帶有注解的域和方法得湘,來創(chuàng)建Bean實例募狂,也不具備自動裝配
    void autowireBean(Object existingBean) throws BeansException;

    /**
     * Configure the given raw bean: autowiring bean properties, applying
     * bean property values, applying factory callbacks such as {@code setBeanName}
     * and {@code setBeanFactory}, and also applying all bean post processors
     * (including ones which might wrap the given raw bean).
     * <p>This is effectively a superset of what {@link #initializeBean} provides,
     * fully applying the configuration specified by the corresponding bean definition.
     * <b>Note: This method requires a bean definition for the given name!</b>
     * @param existingBean the existing bean instance
     * @param beanName the name of the bean, to be passed to it if necessary
     * (a bean definition of that name has to be available)
     * @return the bean instance to use, either the original or a wrapped one
     * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
     * if there is no bean definition with the given name
     * @throws BeansException if the initialization failed
     * @see #initializeBean
     */
/**

*配置給定的原始bean:autowiringbean屬性畜份,應用
*bean屬性值诞帐,應用工廠回調,如{@code setBeanName}
*和{@code setBeanFactory}爆雹,并應用所有bean后處理器
*完全應用相應bean定義指定的配置停蕉。
*該方法需要給定名稱的bean定義
*@param existingBean現(xiàn)有的bean實例
*@param beanName bean的名稱,如果需要钙态,可以傳遞給它
*(必須提供該名稱的bean定義)
*@返回要使用的bean實例慧起,可以是原始的,也可以是包裝的
*@throws org.springframework.beans.factory.NoSuchBeanDefinitionException異常
*如果沒有具有給定名稱的bean定義
*如果初始化失敗册倒,拋出異常throws BeansException
*/
    Object configureBean(Object existingBean, String beanName) throws BeansException;


    //-------------------------------------------------------------------------
    // Specialized methods for fine-grained control over the bean lifecycle
      //對bean生命周期進行細粒度控制的專門方法
    //-------------------------------------------------------------------------

    /**
     * Fully create a new bean instance of the given class with the specified
     * autowire strategy. All constants defined in this interface are supported here.
     * <p>Performs full initialization of the bean, including all applicable
     * {@link BeanPostProcessor BeanPostProcessors}. This is effectively a superset
     * of what {@link #autowire} provides, adding {@link #initializeBean} behavior.
     * @param beanClass the class of the bean to create
     * @param autowireMode by name or type, using the constants in this interface
     * @param dependencyCheck whether to perform a dependency check for objects
     * (not applicable to autowiring a constructor, thus ignored there)
     * @return the new bean instance
     * @throws BeansException if instantiation or wiring failed
     * @see #AUTOWIRE_NO
     * @see #AUTOWIRE_BY_NAME
     * @see #AUTOWIRE_BY_TYPE
     * @see #AUTOWIRE_CONSTRUCTOR
     */
/**
*使用指定的自動連線策略蚓挤。此處支持此接口中定義的所有常量。
*執(zhí)行bean的完全初始化驻子,包括所有適用的
*在{@autowire}提供的功能中屈尼,添加了初始化Bean行為。
*@param beanClass要創(chuàng)建的bean的類
*@param autowireMode按名稱或類型拴孤,使用此接口中的常量
*@param dependency檢查是否對對象執(zhí)行依賴性檢查
*(不適用于自動連接構造函數)
*@return新bean實例
*如果實例化或連接失敗脾歧,將拋出BeansException異常
*@AUTOWIRE  注解按名稱裝配Bean
*/
    Object createBean(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 {@code AUTOWIRE_NO} in order to just apply
     * before-instantiation callbacks (e.g. for annotation-driven injection).
     * <p>Does <i>not</i> apply standard {@link BeanPostProcessor BeanPostProcessors}
     * callbacks or perform any further initialization of the bean. This interface
     * offers distinct, fine-grained operations for those purposes, for example
     * {@link #initializeBean}. However, {@link InstantiationAwareBeanPostProcessor}
     * callbacks are applied, if applicable to the construction of the instance.
     * @param beanClass the class of the bean to instantiate
     * @param autowireMode by name or type, using the constants in this interface
     * @param dependencyCheck whether to perform a dependency check for object
     * references in the bean instance (not applicable to autowiring a constructor,
     * thus ignored there)
     * @return the new bean instance
     * @throws BeansException if instantiation or wiring failed
     * @see #AUTOWIRE_NO
     * @see #AUTOWIRE_BY_NAME
     * @see #AUTOWIRE_BY_TYPE
     * @see #AUTOWIRE_CONSTRUCTOR
     * @see #AUTOWIRE_AUTODETECT
     * @see #initializeBean
     * @see #applyBeanPostProcessorsBeforeInitialization
     * @see #applyBeanPostProcessorsAfterInitialization
     */
/**
*用指定的autowire實例化給定類的新bean實例,此處支持此接口中定義的所有常量演熟。
*也可以用{@AUTOWIRE調用鞭执,以便應用,在實例化回調之前(例如芒粹,對于注釋驅動的注入)兄纺。
*不能應用Bean后處理器
*回調或執(zhí)行bean的任何進一步初始化。此接口
*例如化漆,為這些目的提供不同的細粒度操作
*初始化Bean但是估脆,初始化Bean后處理器回調將應用于實例的構造(如果適用)。
*@param beanClass要實例化的bean的類
*@param autowireMode按名稱或類型座云,使用此接口中的常量
*@param dependencyCheck是否對對象執(zhí)行依賴性檢查
*bean實例中的引用(不適用于自動連接構造函數疙赠,因此被忽略了)
*@return新bean實例
*如果實例化或連接失敗付材,@拋出BeansException
*@見#initializeBean
*@applybeanpostprocessors在初始化之前
*@applybeanpostprocessors初始化后
*/
    Object autowire(Class<?> beanClass, int autowireMode, boolean dependencyCheck) throws BeansException;

    /**
     * Autowire the bean properties of the given bean instance by name or type.
     * Can also be invoked with {@code AUTOWIRE_NO} in order to just apply
     * after-instantiation callbacks (e.g. for annotation-driven injection).
     * <p>Does <i>not</i> apply standard {@link BeanPostProcessor BeanPostProcessors}
     * callbacks or perform any further initialization of the bean. This interface
     * offers distinct, fine-grained operations for those purposes, for example
     * {@link #initializeBean}. However, {@link InstantiationAwareBeanPostProcessor}
     * callbacks are applied, if applicable to the configuration of the instance.
     * @param existingBean the existing bean instance
     * @param autowireMode by name or type, using the constants in this interface
     * @param dependencyCheck whether to perform a dependency check for object
     * references in the bean instance
     * @throws BeansException if wiring failed
     * @see #AUTOWIRE_BY_NAME
     * @see #AUTOWIRE_BY_TYPE
     * @see #AUTOWIRE_NO
     */
/**
*按名稱或類型自動關聯(lián)給定bean實例的bean屬性。
*也可以用{@AUTOWIRE調用圃阳,以便應用實例化后回調(例如注釋驅動的注入)厌衔。
*不能應用在Bean后處理器
*回調或執(zhí)行bean的任何進一步初始化。此接口 例如捍岳,為這些目的提供不同的細粒度操作
*初始化Bean但是富寿,Bean后處理器回調將應用于實例的配置(如果適用)。
*@param existingBean現(xiàn)有的bean實例
*@param autowireMode按名稱或類型锣夹,使用此接口中的常量
*@param dependencyCheck是否對對象執(zhí)行依賴性檢查
*如果裝配失敗页徐,@拋出BeansException
*/
    void autowireBeanProperties(Object existingBean, int autowireMode, boolean dependencyCheck)
            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.
     * <p>This method does <i>not</i> autowire bean properties; it just applies
     * explicitly defined property values. Use the {@link #autowireBeanProperties}
     * method to autowire an existing bean instance.
     * <b>Note: This method requires a bean definition for the given name!</b>
     * <p>Does <i>not</i> apply standard {@link BeanPostProcessor BeanPostProcessors}
     * callbacks or perform any further initialization of the bean. This interface
     * offers distinct, fine-grained operations for those purposes, for example
     * {@link #initializeBean}. However, {@link InstantiationAwareBeanPostProcessor}
     * callbacks are applied, if applicable to the configuration of the instance.
     * @param existingBean the existing bean instance
     * @param beanName the name of the bean definition in the bean factory
     * (a bean definition of that name has to be available)
     * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
     * if there is no bean definition with the given name
     * @throws BeansException if applying the property values failed
     * @see #autowireBeanProperties
     */
/**
*將具有給定名稱的bean定義的屬性值應用于
*給定的bean實例。bean定義可以定義
*自包含bean银萍,重用它的屬性值泞坦,或者只是屬性值
*用于現(xiàn)有bean實例。
*此方法不具有autowire bean屬性它只是適用的顯式定義的屬性值砖顷。使用autowireBeanProperties方法自動關聯(lián)現(xiàn)有bean實例。
*此方法需要給定名稱的bean定義
*不能應用BeanPostProcessor(Bean后處理器)
*回調或執(zhí)行bean的任何進一步初始化赃梧。此接口
*例如滤蝠,為這些目的提供不同的細粒度操作
*initializeBean但是,InstantiationAwareBeanPostProcessor回調將應用于實例的配置(如果適用)授嘀。
*@param existingBean現(xiàn)有的bean實例
*@param beanName bean工廠中bean定義的名稱
*(必須提供該名稱的bean定義)
*@throws org.springframework.beans.factory.NoSuchBeanDefinitionException異常
*如果沒有具有給定名稱的bean定義
*如果應用屬性值失敗物咳,@throws BeansException
*/
    void applyBeanPropertyValues(Object existingBean, String beanName) throws BeansException;

    /**
     * Initialize the given raw bean, applying factory callbacks
     * such as {@code setBeanName} and {@code setBeanFactory},
     * also applying all bean post processors (including ones which
     * might wrap the given raw bean).
     * <p>Note that no bean definition of the given name has to exist
     * in the bean factory. The passed-in bean name will simply be used
     * for callbacks but not checked against the registered bean definitions.
     * @param existingBean the existing bean instance
     * @param beanName the name of the bean, to be passed to it if necessary
     * (only passed to {@link BeanPostProcessor BeanPostProcessors};
     * can follow the {@link #ORIGINAL_INSTANCE_SUFFIX} convention in order to
     * enforce the given instance to be returned, i.e. no proxies etc)
     * @return the bean instance to use, either the original or a wrapped one
     * @throws BeansException if the initialization failed
     * @see #ORIGINAL_INSTANCE_SUFFIX
     */
/**
*初始化給定的原始bean,應用工廠回調
*例如{setBeanName}和{setBeanFactory}蹄皱,
*還應用了所有bean后處理器(包括可以包裝給定的Bean)览闰。
*給定名稱的bean定義不必存在Bean工廠。只需使用傳入的bean名稱
*用于回調巷折,但未根據已注冊的bean定義進行檢查压鉴。
*@param existingBean現(xiàn)有的bean實例
*@param beanName bean的名稱,如果需要锻拘,可以傳遞給它
*(僅傳遞給beanpstoprocessor beanpstoprocessors
*可以遵循ORIGINAL_INSTANCE_SUFFIX后綴約定匹配
*強制返回給定實例油吭,即沒有代理等)
*@返回要使用的bean實例,可以是原始的署拟,也可以是包裝的
*如果初始化失敗婉宰,@throws BeansException
*/
    Object initializeBean(Object existingBean, String beanName) throws BeansException;

    /**
     * Apply {@link BeanPostProcessor BeanPostProcessors} to the given existing bean
     * instance, invoking their {@code postProcessBeforeInitialization} methods.
     * The returned bean instance may be a wrapper around the original.
     * @param existingBean the existing bean instance
     * @param beanName the name of the bean, to be passed to it if necessary
     * (only passed to {@link BeanPostProcessor BeanPostProcessors};
     * can follow the {@link #ORIGINAL_INSTANCE_SUFFIX} convention in order to
     * enforce the given instance to be returned, i.e. no proxies etc)
     * @return the bean instance to use, either the original or a wrapped one
     * @throws BeansException if any post-processing failed
     * @see BeanPostProcessor#postProcessBeforeInitialization
     * @see #ORIGINAL_INSTANCE_SUFFIX
     */
/**

*將{ BeanPostProcessor BeanPostProcessors}應用于給定的現(xiàn)有bean
*實例,調用它們的{postProcessBeforeInitialization}方法推穷。
*返回的bean實例可能是原始bean的包裝器心包。
*@param existingBean現(xiàn)有的bean實例
*@param beanName bean的名稱,如果需要馒铃,可以傳遞給它
*(僅傳遞給{beanpstoprocessor beanpstoprocessors}蟹腾;
*可以遵循{@link#ORIGINAL_INSTANCE_SUFFIX}約定
*強制返回給定實例痕惋,即沒有代理等)
*如果任何后處理失敗,@throws BeansException
*BeanPostProcessor#初始化前的后處理
*/
    Object applyBeanPostProcessorsBeforeInitialization(Object existingBean, String beanName)
            throws BeansException;

    /**
     * Apply {@link BeanPostProcessor BeanPostProcessors} to the given existing bean
     * instance, invoking their {@code postProcessAfterInitialization} methods.
     * The returned bean instance may be a wrapper around the original.
     * @param existingBean the existing bean instance
     * @param beanName the name of the bean, to be passed to it if necessary
     * (only passed to {@link BeanPostProcessor BeanPostProcessors};
     * can follow the {@link #ORIGINAL_INSTANCE_SUFFIX} convention in order to
     * enforce the given instance to be returned, i.e. no proxies etc)
     * @return the bean instance to use, either the original or a wrapped one
     * @throws BeansException if any post-processing failed
     * @see BeanPostProcessor#postProcessAfterInitialization
     * @see #ORIGINAL_INSTANCE_SUFFIX
     */
/**
*將{@link BeanPostProcessor BeanPostProcessors}應用于給定的現(xiàn)有bean
*實例岭佳,調用它們的{@CodePostProcessAfterInitialization}方法血巍。
*返回的bean實例可能是原始bean的包裝器。
*@param existingBean現(xiàn)有的bean實例
*@param beanName bean的名稱珊随,如果需要述寡,可以傳遞給它
*(僅傳遞給{@link beanpstoprocessor beanpstoprocessors};
*可以遵循{@link#ORIGINAL_INSTANCE_SUFFIX}約定
*強制返回給定實例叶洞,即沒有代理等)
*@返回要使用的bean實例鲫凶,可以是原始的,也可以是包裝的
*如果任何后處理失敗衩辟,@throws BeansException
*BeanPostProcessor#初始化后的后處理器
*/
    Object applyBeanPostProcessorsAfterInitialization(Object existingBean, String beanName)
            throws BeansException;

    /**
     * Destroy the given bean instance (typically coming from {@link #createBean}),
     * applying the {@link org.springframework.beans.factory.DisposableBean} contract as well as
     * registered {@link DestructionAwareBeanPostProcessor DestructionAwareBeanPostProcessors}.
     * <p>Any exception that arises during destruction should be caught
     * and logged instead of propagated to the caller of this method.
     * @param existingBean the bean instance to destroy
     */
/**
*銷毀給定的bean實例(通常來自{@link#createBean})螟炫,
*應用{@link org.springframework.beans.factory.DisposableBean}合同以及
*已注冊{@link DestructionAwareBeanPostProcessor DestructionAwareBeanPostProcessors}。
*<p>銷毀過程中出現(xiàn)的任何異常都應被捕獲
*并記錄艺晴,而不是傳播到此方法的調用方昼钻。
*@param existingBean要銷毀的bean實例
*/
    void destroyBean(Object existingBean);


    //-------------------------------------------------------------------------
    // Delegate methods for resolving injection points
    //-------------------------------------------------------------------------

    /**
     * Resolve the bean instance that uniquely matches the given object type, if any,
     * including its bean name.
     * <p>This is effectively a variant of {@link #getBean(Class)} which preserves the
     * bean name of the matching instance.
     * @param requiredType type the bean must match; can be an interface or superclass
     * @return the bean name plus bean instance
     * @throws NoSuchBeanDefinitionException if no matching bean was found
     * @throws NoUniqueBeanDefinitionException if more than one matching bean was found
     * @throws BeansException if the bean could not be created
     * @since 4.3.3
     * @see #getBean(Class)
     */
/**
*解析唯一匹配給定對象類型的bean實例(如果有的話),
*包括它的豆名封寞。
*<p>這實際上是{@link#getBean(Class)}的一個變體然评,它保留了
*匹配實例的bean名稱。
*@param requiredType bean必須匹配的類型狈究;可以是接口或超類
*@return bean name加bean實例
*如果找不到匹配的bean碗淌,@拋出NoSuchBeanDefinitionException
*如果找到多個匹配bean,@throws NoUniqueBeanDefinitionException
*如果無法創(chuàng)建bean抖锥,@throws BeansException
*@自4.3.3
*@see#getBean(類)
*/
    <T> NamedBeanHolder<T> resolveNamedBean(Class<T> requiredType) throws BeansException;

    /**
     * Resolve a bean instance for the given bean name, providing a dependency descriptor
     * for exposure to target factory methods.
     * <p>This is effectively a variant of {@link #getBean(String, Class)} which supports
     * factory methods with an {@link org.springframework.beans.factory.InjectionPoint}
     * argument.
     * @param name the name of the bean to look up
     * @param descriptor the dependency descriptor for the requesting injection point
     * @return the corresponding bean instance
     * @throws NoSuchBeanDefinitionException if there is no bean with the specified name
     * @throws BeansException if the bean could not be created
     * @since 5.1.5
     * @see #getBean(String, Class)
     */
/**
*為給定的bean名稱解析bean實例亿眠,提供依賴描述符
*用于接觸目標工廠方法。
*<p>這實際上是{@link#getBean(String磅废,Class)}的一個變體纳像,它支持
*帶有{@link org.springframework.beans.factory.InjectionPoint}的工廠方法
*爭論。
*@param name要查找的bean的名稱
*@param descriptor請求注入點的依賴關系描述符
*@返回對應的bean實例
*如果沒有具有指定名稱的bean拯勉,@拋出NoSuchBeanDefinitionException
*如果無法創(chuàng)建bean爹耗,@throws BeansException
*@自5.1.5
*@see#getBean(字符串,類)
*/
    Object resolveBeanByName(String name, DependencyDescriptor descriptor) throws BeansException;

    /**
     * Resolve the specified dependency against the beans defined in this factory.
     * @param descriptor the descriptor for the dependency (field/method/constructor)
     * @param requestingBeanName the name of the bean which declares the given dependency
     * @return the resolved object, or {@code null} if none found
     * @throws NoSuchBeanDefinitionException if no matching bean was found
     * @throws NoUniqueBeanDefinitionException if more than one matching bean was found
     * @throws BeansException if dependency resolution failed for any other reason
     * @since 2.5
     * @see #resolveDependency(DependencyDescriptor, String, Set, TypeConverter)
     */
/**
*根據此工廠中定義的bean解析指定的依賴關系谜喊。
*@param descriptor依賴項的描述符(字段/方法/構造函數)
*@param requestingBeanName聲明給定依賴項的bean的名稱
*@返回已解析的對象潭兽,如果找不到,則返回{@code null}
*如果找不到匹配的bean斗遏,@拋出NoSuchBeanDefinitionException
*如果找到多個匹配bean山卦,@throws NoUniqueBeanDefinitionException
*如果依賴項解析因任何其他原因失敗,@throws BeansException
*@自2.5
*@see#resolveDependency(DependencyDescriptor、String账蓉、Set枚碗、TypeConverter)
*/
    @Nullable
    Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName) throws BeansException;

    /**
     * Resolve the specified dependency against the beans defined in this factory.
     * @param descriptor the descriptor for the dependency (field/method/constructor)
     * @param requestingBeanName the name of the bean which declares the given dependency
     * @param autowiredBeanNames a Set that all names of autowired beans (used for
     * resolving the given dependency) are supposed to be added to
     * @param typeConverter the TypeConverter to use for populating arrays and collections
     * @return the resolved object, or {@code null} if none found
     * @throws NoSuchBeanDefinitionException if no matching bean was found
     * @throws NoUniqueBeanDefinitionException if more than one matching bean was found
     * @throws BeansException if dependency resolution failed for any other reason
     * @since 2.5
     * @see DependencyDescriptor
     */
/**
*根據此工廠中定義的bean解析指定的依賴關系。
*@param descriptor依賴項的描述符(字段/方法/構造函數)
*@param requestingBeanName聲明給定依賴項的bean的名稱
*@param autowiredBeanNames一個集合铸本,所有autowired bean的名稱(用于
*解析給定的依賴關系)應該添加到
*@param typeConverter用于填充數組和集合的typeConverter
*@返回已解析的對象肮雨,如果找不到,則返回{@code null}
*如果找不到匹配的bean箱玷,@拋出NoSuchBeanDefinitionException
*如果找到多個匹配bean怨规,@throws NoUniqueBeanDefinitionException
*如果依賴項解析因任何其他原因失敗,@throws BeansException
*@自2.5
*@參見DependencyDescriptor
*/
    @Nullable
    Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName,
            @Nullable Set<String> autowiredBeanNames, @Nullable TypeConverter typeConverter) throws BeansException;

}
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末锡足,一起剝皮案震驚了整個濱河市波丰,隨后出現(xiàn)的幾起案子会喝,更是在濱河造成了極大的恐慌邪狞,老刑警劉巖,帶你破解...
    沈念sama閱讀 218,941評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件急波,死亡現(xiàn)場離奇詭異沐批,居然都是意外死亡纫骑,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,397評論 3 395
  • 文/潘曉璐 我一進店門九孩,熙熙樓的掌柜王于貴愁眉苦臉地迎上來先馆,“玉大人,你說我怎么就攤上這事捻撑。” “怎么了缤底?”我有些...
    開封第一講書人閱讀 165,345評論 0 356
  • 文/不壞的土叔 我叫張陵顾患,是天一觀的道長。 經常有香客問我个唧,道長江解,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,851評論 1 295
  • 正文 為了忘掉前任徙歼,我火速辦了婚禮犁河,結果婚禮上,老公的妹妹穿的比我還像新娘魄梯。我一直安慰自己桨螺,他們只是感情好,可當我...
    茶點故事閱讀 67,868評論 6 392
  • 文/花漫 我一把揭開白布酿秸。 她就那樣靜靜地躺著灭翔,像睡著了一般。 火紅的嫁衣襯著肌膚如雪辣苏。 梳的紋絲不亂的頭發(fā)上肝箱,一...
    開封第一講書人閱讀 51,688評論 1 305
  • 那天哄褒,我揣著相機與錄音,去河邊找鬼煌张。 笑死呐赡,一個胖子當著我的面吹牛,可吹牛的內容都是我干的骏融。 我是一名探鬼主播链嘀,決...
    沈念sama閱讀 40,414評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼绎谦!你這毒婦竟也來了管闷?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 39,319評論 0 276
  • 序言:老撾萬榮一對情侶失蹤窃肠,失蹤者是張志新(化名)和其女友劉穎包个,沒想到半個月后,有當地人在樹林里發(fā)現(xiàn)了一具尸體冤留,經...
    沈念sama閱讀 45,775評論 1 315
  • 正文 獨居荒郊野嶺守林人離奇死亡碧囊,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 37,945評論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了纤怒。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片糯而。...
    茶點故事閱讀 40,096評論 1 350
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖泊窘,靈堂內的尸體忽然破棺而出熄驼,到底是詐尸還是另有隱情,我是刑警寧澤烘豹,帶...
    沈念sama閱讀 35,789評論 5 346
  • 正文 年R本政府宣布瓜贾,位于F島的核電站,受9級特大地震影響携悯,放射性物質發(fā)生泄漏祭芦。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,437評論 3 331
  • 文/蒙蒙 一憔鬼、第九天 我趴在偏房一處隱蔽的房頂上張望龟劲。 院中可真熱鬧,春花似錦轴或、人聲如沸昌跌。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,993評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽避矢。三九已至,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間审胸,已是汗流浹背亥宿。 一陣腳步聲響...
    開封第一講書人閱讀 33,107評論 1 271
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留砂沛,地道東北人烫扼。 一個月前我還...
    沈念sama閱讀 48,308評論 3 372
  • 正文 我出身青樓,卻偏偏與公主長得像碍庵,于是被迫代替她去往敵國和親映企。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 45,037評論 2 355