Example usage for org.springframework.beans.factory.support RootBeanDefinition getTargetType

List of usage examples for org.springframework.beans.factory.support RootBeanDefinition getTargetType

Introduction

In this page you can find the example usage for org.springframework.beans.factory.support RootBeanDefinition getTargetType.

Prototype

@Nullable
public Class<?> getTargetType() 

Source Link

Document

Return the target type of this bean definition, if known (either specified in advance or resolved on first instantiation).

Usage

From source file:org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.java

/**
 * Determine the target type for the given bean definition.
 * @param beanName the name of the bean (for error handling purposes)
 * @param mbd the merged bean definition for the bean
 * @param typesToMatch the types to match in case of internal type matching purposes
 * (also signals that the returned {@code Class} will never be exposed to application code)
 * @return the type for the bean if determinable, or {@code null} otherwise
 *//*  www .j a  va2  s. co  m*/
@Nullable
protected Class<?> determineTargetType(String beanName, RootBeanDefinition mbd, Class<?>... typesToMatch) {
    Class<?> targetType = mbd.getTargetType();
    if (targetType == null) {
        targetType = (mbd.getFactoryMethodName() != null ? getTypeForFactoryMethod(beanName, mbd, typesToMatch)
                : resolveBeanClass(mbd, beanName, typesToMatch));
        if (ObjectUtils.isEmpty(typesToMatch) || getTempClassLoader() == null) {
            mbd.resolvedTargetType = targetType;
        }
    }
    return targetType;
}