001/*
002 * Copyright 2002-2016 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.aop.framework.autoproxy;
018
019import org.springframework.aop.TargetSource;
020import org.springframework.lang.Nullable;
021
022/**
023 * Implementations can create special target sources, such as pooling target
024 * sources, for particular beans. For example, they may base their choice
025 * on attributes, such as a pooling attribute, on the target class.
026 *
027 * <p>AbstractAutoProxyCreator can support a number of TargetSourceCreators,
028 * which will be applied in order.
029 *
030 * @author Rod Johnson
031 * @author Juergen Hoeller
032 */
033@FunctionalInterface
034public interface TargetSourceCreator {
035
036        /**
037         * Create a special TargetSource for the given bean, if any.
038         * @param beanClass the class of the bean to create a TargetSource for
039         * @param beanName the name of the bean
040         * @return a special TargetSource or {@code null} if this TargetSourceCreator isn't
041         * interested in the particular bean
042         */
043        @Nullable
044        TargetSource getTargetSource(Class<?> beanClass, String beanName);
045
046}