|
| 1 | +/* |
| 2 | + * Copyright 2002-present the original author or authors. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +package org.springframework.context.annotation; |
| 18 | + |
| 19 | +import java.lang.annotation.Documented; |
| 20 | +import java.lang.annotation.ElementType; |
| 21 | +import java.lang.annotation.Retention; |
| 22 | +import java.lang.annotation.RetentionPolicy; |
| 23 | +import java.lang.annotation.Target; |
| 24 | + |
| 25 | +/** |
| 26 | + * Common annotation for suggesting a specific proxy type for a {@link Bean @Bean} |
| 27 | + * method or {@link org.springframework.stereotype.Component @Component} class, |
| 28 | + * overriding a globally configured default. |
| 29 | + * |
| 30 | + * <p>Only actually applying in case of a bean actually getting auto-proxied in |
| 31 | + * the first place. Actual auto-proxying is dependent on external configuration. |
| 32 | + * |
| 33 | + * @author Juergen Hoeller |
| 34 | + * @since 7.0 |
| 35 | + * @see org.springframework.aop.framework.autoproxy.AutoProxyUtils#PRESERVE_TARGET_CLASS_ATTRIBUTE |
| 36 | + * @see org.springframework.aop.framework.autoproxy.AutoProxyUtils#EXPOSED_INTERFACES_ATTRIBUTE |
| 37 | + */ |
| 38 | +@Target({ElementType.TYPE, ElementType.METHOD}) |
| 39 | +@Retention(RetentionPolicy.RUNTIME) |
| 40 | +@Documented |
| 41 | +public @interface Proxyable { |
| 42 | + |
| 43 | + /** |
| 44 | + * Suggest a specific proxy type, either {@link ProxyType#INTERFACES} for |
| 45 | + * a JDK dynamic proxy or {@link ProxyType#TARGET_CLASS} for a CGLIB proxy, |
| 46 | + * overriding a globally configured default. |
| 47 | + */ |
| 48 | + ProxyType value() default ProxyType.DEFAULT; |
| 49 | + |
| 50 | + /** |
| 51 | + * Suggest a JDK dynamic proxy with specific interfaces to expose, overriding |
| 52 | + * a globally configured default. |
| 53 | + * <p>Only taken into account if {@link #value()} is not {@link ProxyType#TARGET_CLASS}. |
| 54 | + */ |
| 55 | + Class<?>[] interfaces() default {}; |
| 56 | + |
| 57 | + |
| 58 | +} |
0 commit comments