spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java
/**
	 * Template method for resolving the specified argument which is supposed to be autowired.
	 */
Template method for resolving the specified argument which is supposed to be autowired.
Template method for resolving the specified argument which is supposed to be autowired .
@Nullable
	protected Object resolveAutowiredArgument(MethodParameter param, String beanName,
											  @Nullable Set<String> autowiredBeanNames, TypeConverter typeConverter, boolean fallback) {
		Class<?> paramType = param.getParameterType();
		if (InjectionPoint.class.isAssignableFrom(paramType)) {
			InjectionPoint injectionPoint = currentInjectionPoint.get();
			if (injectionPoint == null) {
				throw new IllegalStateException("No current InjectionPoint available for " + param);
			}
			return injectionPoint;
		}
		try {
			return this.beanFactory.resolveDependency(
					new DependencyDescriptor(param, true), beanName, autowiredBeanNames, typeConverter);
		} catch (NoUniqueBeanDefinitionException ex) {
			throw ex;
		} catch (NoSuchBeanDefinitionException ex) {
			if (fallback) {
				if (paramType.isArray()) {
					return Array.newInstance(paramType.getComponentType(), 0);
				} else if (CollectionFactory.isApproximableCollectionType(paramType)) {
					return CollectionFactory.createCollection(paramType, 0);
				} else if (CollectionFactory.isApproximableMapType(paramType)) {
					return CollectionFactory.createMap(paramType, 0);
				}
			}
			throw ex;
		}
	}
@ Nullable protected Object resolveAutowiredArgument ( MethodParameter param , String beanName , @ Nullable Set < String > autowiredBeanNames , TypeConverter typeConverter , boolean fallback ) { Class < ? > paramType = param . getParameterType ( ) ; if ( InjectionPoint . class . isAssignableFrom ( paramType ) ) { InjectionPoint injectionPoint = currentInjectionPoint . get ( ) ; if ( injectionPoint == null ) { throw new IllegalStateException ( "No current InjectionPoint available for " + param ) ; } return injectionPoint ; } try { return this . beanFactory . resolveDependency ( new DependencyDescriptor ( param , true ) , beanName , autowiredBeanNames , typeConverter ) ; } catch ( NoUniqueBeanDefinitionException ex ) { throw ex ; } catch ( NoSuchBeanDefinitionException ex ) { if ( fallback ) { if ( paramType . isArray ( ) ) { return Array . newInstance ( paramType . getComponentType ( ) , 0 ) ; } else if ( CollectionFactory . isApproximableCollectionType ( paramType ) ) { return CollectionFactory . createCollection ( paramType , 0 ) ; } else if ( CollectionFactory . isApproximableMapType ( paramType ) ) { return CollectionFactory . createMap ( paramType , 0 ) ; } } throw ex ; } }
Template method for resolving the specified argument which is supposed to be autowired.
Template method for resolving the specified argument which is supposed to be autowired .
// Single constructor or factory method -> let's return an empty array/collection // for e.g. a vararg or a non-null List/Set/Map parameter.