Skip to content

Commit 625737f

Browse files
committed
Controller/Repository/Service declare value attribute as alias for Component
Issue: SPR-16066
1 parent 682186a commit 625737f

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

spring-context/src/main/java/org/springframework/stereotype/Controller.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import java.lang.annotation.RetentionPolicy;
2323
import java.lang.annotation.Target;
2424

25+
import org.springframework.core.annotation.AliasFor;
26+
2527
/**
2628
* Indicates that an annotated class is a "Controller" (e.g. a web controller).
2729
*
@@ -48,6 +50,7 @@
4850
* to be turned into a Spring bean in case of an autodetected component.
4951
* @return the suggested component name, if any
5052
*/
53+
@AliasFor(annotation = Component.class)
5154
String value() default "";
5255

5356
}

spring-context/src/main/java/org/springframework/stereotype/Repository.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import java.lang.annotation.RetentionPolicy;
2323
import java.lang.annotation.Target;
2424

25+
import org.springframework.core.annotation.AliasFor;
26+
2527
/**
2628
* Indicates that an annotated class is a "Repository", originally defined by
2729
* Domain-Driven Design (Evans, 2003) as "a mechanism for encapsulating storage,
@@ -64,6 +66,7 @@
6466
* to be turned into a Spring bean in case of an autodetected component.
6567
* @return the suggested component name, if any
6668
*/
69+
@AliasFor(annotation = Component.class)
6770
String value() default "";
6871

6972
}

spring-context/src/main/java/org/springframework/stereotype/Service.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import java.lang.annotation.RetentionPolicy;
2323
import java.lang.annotation.Target;
2424

25+
import org.springframework.core.annotation.AliasFor;
26+
2527
/**
2628
* Indicates that an annotated class is a "Service", originally defined by Domain-Driven
2729
* Design (Evans, 2003) as "an operation offered as an interface that stands alone in the
@@ -50,6 +52,7 @@
5052
* to be turned into a Spring bean in case of an autodetected component.
5153
* @return the suggested component name, if any
5254
*/
55+
@AliasFor(annotation = Component.class)
5356
String value() default "";
5457

5558
}

0 commit comments

Comments
 (0)