Skip to content

Commit 9f15f34

Browse files
committed
Renamed 'name' attribute to 'scopeName' (in order to avoid common override conflicts)
Issue: SPR-13239
1 parent 106cce5 commit 9f15f34

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

spring-context/src/main/java/org/springframework/context/annotation/Scope.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858
public @interface Scope {
5959

6060
/**
61-
* Alias for {@link #name}.
62-
* @see #name
61+
* Alias for {@link #scopeName}.
62+
* @see #scopeName
6363
*/
64-
@AliasFor(attribute = "name")
64+
@AliasFor(attribute = "scopeName")
6565
String value() default "";
6666

6767
/**
@@ -76,7 +76,7 @@
7676
* @see #value
7777
*/
7878
@AliasFor(attribute = "value")
79-
String name() default "";
79+
String scopeName() default "";
8080

8181
/**
8282
* Specifies whether a component should be configured as a scoped proxy

spring-context/src/test/java/org/springframework/context/annotation/AnnotationScopeMetadataResolverTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class AnnotationScopeMetadataResolverTests {
4444

4545
private AnnotationScopeMetadataResolver scopeMetadataResolver = new AnnotationScopeMetadataResolver();
4646

47+
4748
@Test
4849
public void resolveScopeMetadataShouldNotApplyScopedProxyModeToSingleton() {
4950
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithSingletonScope.class);
@@ -65,7 +66,6 @@ public void resolveScopeMetadataShouldApplyScopedProxyModeToPrototype() {
6566

6667
@Test
6768
public void resolveScopeMetadataShouldReadScopedProxyModeFromAnnotation() {
68-
this.scopeMetadataResolver = new AnnotationScopeMetadataResolver();
6969
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithScopedProxy.class);
7070
ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
7171
assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
@@ -133,6 +133,7 @@ public void setScopeAnnotationTypeWithNullType() {
133133
@Retention(RetentionPolicy.RUNTIME)
134134
@Scope("request")
135135
@interface CustomRequestScopeWithAttributeOverride {
136+
136137
ScopedProxyMode proxyMode();
137138
}
138139

@@ -144,7 +145,7 @@ private static class AnnotatedWithSingletonScope {
144145
private static class AnnotatedWithPrototypeScope {
145146
}
146147

147-
@Scope(name = "request", proxyMode = TARGET_CLASS)
148+
@Scope(scopeName = "request", proxyMode = TARGET_CLASS)
148149
private static class AnnotatedWithScopedProxy {
149150
}
150151

spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ public String toString() {
787787
public static class ScopedProxyRepositoryConfiguration {
788788

789789
@Bean
790-
@Scope(name = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
790+
@Scope(scopeName = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
791791
public Repository<String> stringRepo() {
792792
return new Repository<String>() {
793793
@Override
@@ -798,7 +798,7 @@ public String toString() {
798798
}
799799

800800
@Bean
801-
@Scope(name = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
801+
@Scope(scopeName = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
802802
public Repository<Integer> integerRepo() {
803803
return new Repository<Integer>() {
804804
@Override

spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/RequestContextHolderTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ public SingletonController singletonController() {
143143
}
144144

145145
@Bean
146-
@Scope(name = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
146+
@Scope(scopeName = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
147147
public RequestScopedController requestScopedController() {
148148
return new RequestScopedController();
149149
}
150150

151151
@Bean
152-
@Scope(name = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
152+
@Scope(scopeName = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
153153
public RequestScopedService requestScopedService() {
154154
return new RequestScopedService();
155155
}
@@ -160,7 +160,7 @@ public ControllerWithRequestScopedService controllerWithRequestScopedService() {
160160
}
161161

162162
@Bean
163-
@Scope(name = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
163+
@Scope(scopeName = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
164164
public SessionScopedService sessionScopedService() {
165165
return new SessionScopedService();
166166
}

0 commit comments

Comments
 (0)