001/*
002 * Copyright 2002-2013 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.beans.factory.support;
018
019import org.springframework.beans.factory.config.BeanDefinitionHolder;
020import org.springframework.beans.factory.config.DependencyDescriptor;
021
022/**
023 * Strategy interface for determining whether a specific bean definition
024 * qualifies as an autowire candidate for a specific dependency.
025 *
026 * @author Juergen Hoeller
027 * @author Mark Fisher
028 * @since 2.5
029 */
030public interface AutowireCandidateResolver {
031
032        /**
033         * Determine whether the given bean definition qualifies as an
034         * autowire candidate for the given dependency.
035         * @param bdHolder the bean definition including bean name and aliases
036         * @param descriptor the descriptor for the target method parameter or field
037         * @return whether the bean definition qualifies as autowire candidate
038         */
039        boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor);
040
041        /**
042         * Determine whether a default value is suggested for the given dependency.
043         * @param descriptor the descriptor for the target method parameter or field
044         * @return the value suggested (typically an expression String),
045         * or {@code null} if none found
046         * @since 3.0
047         */
048        Object getSuggestedValue(DependencyDescriptor descriptor);
049
050        /**
051         * Build a proxy for lazy resolution of the actual dependency target,
052         * if demanded by the injection point.
053         * @param descriptor the descriptor for the target method parameter or field
054         * @param beanName the name of the bean that contains the injection point
055         * @return the lazy resolution proxy for the actual dependency target,
056         * or {@code null} if straight resolution is to be performed
057         * @since 4.0
058         */
059        Object getLazyResolutionProxyIfNecessary(DependencyDescriptor descriptor, String beanName);
060
061}