From 9f15f347bf11baa2d00543ddcde3e2de692ae6cb Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 17 Jul 2015 15:23:47 +0200 Subject: [PATCH] Renamed 'name' attribute to 'scopeName' (in order to avoid common override conflicts) Issue: SPR-13239 --- .../org/springframework/context/annotation/Scope.java | 8 ++++---- .../annotation/AnnotationScopeMetadataResolverTests.java | 5 +++-- .../annotation/ConfigurationClassPostProcessorTests.java | 4 ++-- .../servlet/samples/spr/RequestContextHolderTests.java | 6 +++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/annotation/Scope.java b/spring-context/src/main/java/org/springframework/context/annotation/Scope.java index 8df50327ade..98488e8610a 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/Scope.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/Scope.java @@ -58,10 +58,10 @@ import org.springframework.core.annotation.AliasFor; public @interface Scope { /** - * Alias for {@link #name}. - * @see #name + * Alias for {@link #scopeName}. + * @see #scopeName */ - @AliasFor(attribute = "name") + @AliasFor(attribute = "scopeName") String value() default ""; /** @@ -76,7 +76,7 @@ public @interface Scope { * @see #value */ @AliasFor(attribute = "value") - String name() default ""; + String scopeName() default ""; /** * Specifies whether a component should be configured as a scoped proxy diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationScopeMetadataResolverTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationScopeMetadataResolverTests.java index 6423156c81f..485494d6102 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationScopeMetadataResolverTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationScopeMetadataResolverTests.java @@ -44,6 +44,7 @@ public class AnnotationScopeMetadataResolverTests { private AnnotationScopeMetadataResolver scopeMetadataResolver = new AnnotationScopeMetadataResolver(); + @Test public void resolveScopeMetadataShouldNotApplyScopedProxyModeToSingleton() { AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithSingletonScope.class); @@ -65,7 +66,6 @@ public class AnnotationScopeMetadataResolverTests { @Test public void resolveScopeMetadataShouldReadScopedProxyModeFromAnnotation() { - this.scopeMetadataResolver = new AnnotationScopeMetadataResolver(); AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithScopedProxy.class); ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd); assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata); @@ -133,6 +133,7 @@ public class AnnotationScopeMetadataResolverTests { @Retention(RetentionPolicy.RUNTIME) @Scope("request") @interface CustomRequestScopeWithAttributeOverride { + ScopedProxyMode proxyMode(); } @@ -144,7 +145,7 @@ public class AnnotationScopeMetadataResolverTests { private static class AnnotatedWithPrototypeScope { } - @Scope(name = "request", proxyMode = TARGET_CLASS) + @Scope(scopeName = "request", proxyMode = TARGET_CLASS) private static class AnnotatedWithScopedProxy { } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java index 502524c18fc..dd32a92cc9f 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java @@ -787,7 +787,7 @@ public class ConfigurationClassPostProcessorTests { public static class ScopedProxyRepositoryConfiguration { @Bean - @Scope(name = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS) + @Scope(scopeName = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS) public Repository stringRepo() { return new Repository() { @Override @@ -798,7 +798,7 @@ public class ConfigurationClassPostProcessorTests { } @Bean - @Scope(name = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS) + @Scope(scopeName = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS) public Repository integerRepo() { return new Repository() { @Override diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/RequestContextHolderTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/RequestContextHolderTests.java index c0f8210e419..8ad73beee8a 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/RequestContextHolderTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/RequestContextHolderTests.java @@ -143,13 +143,13 @@ public class RequestContextHolderTests { } @Bean - @Scope(name = "request", proxyMode = ScopedProxyMode.TARGET_CLASS) + @Scope(scopeName = "request", proxyMode = ScopedProxyMode.TARGET_CLASS) public RequestScopedController requestScopedController() { return new RequestScopedController(); } @Bean - @Scope(name = "request", proxyMode = ScopedProxyMode.TARGET_CLASS) + @Scope(scopeName = "request", proxyMode = ScopedProxyMode.TARGET_CLASS) public RequestScopedService requestScopedService() { return new RequestScopedService(); } @@ -160,7 +160,7 @@ public class RequestContextHolderTests { } @Bean - @Scope(name = "session", proxyMode = ScopedProxyMode.TARGET_CLASS) + @Scope(scopeName = "session", proxyMode = ScopedProxyMode.TARGET_CLASS) public SessionScopedService sessionScopedService() { return new SessionScopedService(); }