Controller/Repository/Service declare value attribute as alias for Component

Issue: SPR-16066
This commit is contained in:
Juergen Hoeller
2017-10-13 14:24:12 +02:00
parent 682186a20d
commit 625737f90a
3 changed files with 9 additions and 0 deletions

View File

@@ -22,6 +22,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
/**
* Indicates that an annotated class is a "Controller" (e.g. a web controller).
*
@@ -48,6 +50,7 @@ public @interface Controller {
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any
*/
@AliasFor(annotation = Component.class)
String value() default "";
}

View File

@@ -22,6 +22,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
/**
* Indicates that an annotated class is a "Repository", originally defined by
* Domain-Driven Design (Evans, 2003) as "a mechanism for encapsulating storage,
@@ -64,6 +66,7 @@ public @interface Repository {
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any
*/
@AliasFor(annotation = Component.class)
String value() default "";
}

View File

@@ -22,6 +22,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
/**
* Indicates that an annotated class is a "Service", originally defined by Domain-Driven
* Design (Evans, 2003) as "an operation offered as an interface that stands alone in the
@@ -50,6 +52,7 @@ public @interface Service {
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any
*/
@AliasFor(annotation = Component.class)
String value() default "";
}