Renamed 'name' attribute to 'scopeName' (in order to avoid common override conflicts)
Issue: SPR-13239
This commit is contained in:
@@ -58,10 +58,10 @@ import org.springframework.core.annotation.AliasFor;
|
|||||||
public @interface Scope {
|
public @interface Scope {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias for {@link #name}.
|
* Alias for {@link #scopeName}.
|
||||||
* @see #name
|
* @see #scopeName
|
||||||
*/
|
*/
|
||||||
@AliasFor(attribute = "name")
|
@AliasFor(attribute = "scopeName")
|
||||||
String value() default "";
|
String value() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,7 +76,7 @@ public @interface Scope {
|
|||||||
* @see #value
|
* @see #value
|
||||||
*/
|
*/
|
||||||
@AliasFor(attribute = "value")
|
@AliasFor(attribute = "value")
|
||||||
String name() default "";
|
String scopeName() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies whether a component should be configured as a scoped proxy
|
* Specifies whether a component should be configured as a scoped proxy
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public class AnnotationScopeMetadataResolverTests {
|
|||||||
|
|
||||||
private AnnotationScopeMetadataResolver scopeMetadataResolver = new AnnotationScopeMetadataResolver();
|
private AnnotationScopeMetadataResolver scopeMetadataResolver = new AnnotationScopeMetadataResolver();
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resolveScopeMetadataShouldNotApplyScopedProxyModeToSingleton() {
|
public void resolveScopeMetadataShouldNotApplyScopedProxyModeToSingleton() {
|
||||||
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithSingletonScope.class);
|
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithSingletonScope.class);
|
||||||
@@ -65,7 +66,6 @@ public class AnnotationScopeMetadataResolverTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void resolveScopeMetadataShouldReadScopedProxyModeFromAnnotation() {
|
public void resolveScopeMetadataShouldReadScopedProxyModeFromAnnotation() {
|
||||||
this.scopeMetadataResolver = new AnnotationScopeMetadataResolver();
|
|
||||||
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithScopedProxy.class);
|
AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithScopedProxy.class);
|
||||||
ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
|
ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
|
||||||
assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
|
assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
|
||||||
@@ -133,6 +133,7 @@ public class AnnotationScopeMetadataResolverTests {
|
|||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Scope("request")
|
@Scope("request")
|
||||||
@interface CustomRequestScopeWithAttributeOverride {
|
@interface CustomRequestScopeWithAttributeOverride {
|
||||||
|
|
||||||
ScopedProxyMode proxyMode();
|
ScopedProxyMode proxyMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +145,7 @@ public class AnnotationScopeMetadataResolverTests {
|
|||||||
private static class AnnotatedWithPrototypeScope {
|
private static class AnnotatedWithPrototypeScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scope(name = "request", proxyMode = TARGET_CLASS)
|
@Scope(scopeName = "request", proxyMode = TARGET_CLASS)
|
||||||
private static class AnnotatedWithScopedProxy {
|
private static class AnnotatedWithScopedProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -787,7 +787,7 @@ public class ConfigurationClassPostProcessorTests {
|
|||||||
public static class ScopedProxyRepositoryConfiguration {
|
public static class ScopedProxyRepositoryConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Scope(name = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
@Scope(scopeName = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||||
public Repository<String> stringRepo() {
|
public Repository<String> stringRepo() {
|
||||||
return new Repository<String>() {
|
return new Repository<String>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -798,7 +798,7 @@ public class ConfigurationClassPostProcessorTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Scope(name = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
@Scope(scopeName = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||||
public Repository<Integer> integerRepo() {
|
public Repository<Integer> integerRepo() {
|
||||||
return new Repository<Integer>() {
|
return new Repository<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -143,13 +143,13 @@ public class RequestContextHolderTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Scope(name = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
@Scope(scopeName = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||||
public RequestScopedController requestScopedController() {
|
public RequestScopedController requestScopedController() {
|
||||||
return new RequestScopedController();
|
return new RequestScopedController();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Scope(name = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
@Scope(scopeName = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||||
public RequestScopedService requestScopedService() {
|
public RequestScopedService requestScopedService() {
|
||||||
return new RequestScopedService();
|
return new RequestScopedService();
|
||||||
}
|
}
|
||||||
@@ -160,7 +160,7 @@ public class RequestContextHolderTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Scope(name = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
@Scope(scopeName = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||||
public SessionScopedService sessionScopedService() {
|
public SessionScopedService sessionScopedService() {
|
||||||
return new SessionScopedService();
|
return new SessionScopedService();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user