Consistent use of @AliasFor

Closes gh-10836
This commit is contained in:
Stephane Nicoll 2017-12-13 14:42:16 +01:00
parent 47c8b5731a
commit a626f5462d
5 changed files with 12 additions and 2 deletions

View File

@ -58,7 +58,7 @@ public @interface SpringBootApplication {
* Exclude specific auto-configuration classes such that they will never be applied. * Exclude specific auto-configuration classes such that they will never be applied.
* @return the classes to exclude * @return the classes to exclude
*/ */
@AliasFor(annotation = EnableAutoConfiguration.class, attribute = "exclude") @AliasFor(annotation = EnableAutoConfiguration.class)
Class<?>[] exclude() default {}; Class<?>[] exclude() default {};
/** /**
@ -67,7 +67,7 @@ public @interface SpringBootApplication {
* @return the class names to exclude * @return the class names to exclude
* @since 1.3.0 * @since 1.3.0
*/ */
@AliasFor(annotation = EnableAutoConfiguration.class, attribute = "excludeName") @AliasFor(annotation = EnableAutoConfiguration.class)
String[] excludeName() default {}; String[] excludeName() default {};
/** /**

View File

@ -24,6 +24,7 @@ import java.lang.annotation.Target;
import org.springframework.boot.context.TypeExcludeFilter; import org.springframework.boot.context.TypeExcludeFilter;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
@ -50,6 +51,7 @@ public @interface TestComponent {
* a Spring bean in case of an auto-detected component. * a Spring bean in case of an auto-detected component.
* @return the specified bean name, if any * @return the specified bean name, if any
*/ */
@AliasFor(annotation = Component.class)
String value() default ""; String value() default "";
} }

View File

@ -24,6 +24,7 @@ import java.lang.annotation.Target;
import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AliasFor;
/** /**
* {@link Configuration @Configuration} that can be used to define additional beans or * {@link Configuration @Configuration} that can be used to define additional beans or
@ -47,6 +48,7 @@ public @interface TestConfiguration {
* Configuration class. See {@link Configuration#value()} for details. * Configuration class. See {@link Configuration#value()} for details.
* @return the specified bean name, if any * @return the specified bean name, if any
*/ */
@AliasFor(annotation = Configuration.class)
String value() default ""; String value() default "";
} }

View File

@ -22,14 +22,18 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
@Endpoint @Endpoint
public @interface MetaEndpoint { public @interface MetaEndpoint {
@AliasFor(annotation = Endpoint.class)
String id(); String id();
@AliasFor(annotation = Endpoint.class)
boolean enableByDefault() default true; boolean enableByDefault() default true;
} }

View File

@ -25,6 +25,7 @@ import java.lang.annotation.Target;
import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.JsonSerializer;
import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
@ -67,6 +68,7 @@ public @interface JsonComponent {
* a Spring bean in case of an autodetected component. * a Spring bean in case of an autodetected component.
* @return the component name * @return the component name
*/ */
@AliasFor(annotation = Component.class)
String value() default ""; String value() default "";
} }