From 153ff751ab2bc20278846bc0e30f6aa4a54173a3 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 1 Feb 2010 16:30:21 +0000 Subject: [PATCH] component-scan's scoped-proxy attribute applies to scope-annotated singleton beans as well (SPR-6683) git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2894 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../AnnotationScopeMetadataResolver.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationScopeMetadataResolver.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationScopeMetadataResolver.java index eda107dacfb..1c201527b94 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationScopeMetadataResolver.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationScopeMetadataResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,16 +78,13 @@ public class AnnotationScopeMetadataResolver implements ScopeMetadataResolver { AnnotatedBeanDefinition annDef = (AnnotatedBeanDefinition) definition; Map attributes = annDef.getMetadata().getAnnotationAttributes(this.scopeAnnotationType.getName()); - ScopedProxyMode annMode = null; if (attributes != null) { metadata.setScopeName((String) attributes.get("value")); - annMode = (ScopedProxyMode) attributes.get("proxyMode"); - } - if (annMode != null && annMode != ScopedProxyMode.DEFAULT) { - metadata.setScopedProxyMode(annMode); - } - else if (!metadata.getScopeName().equals(BeanDefinition.SCOPE_SINGLETON)) { - metadata.setScopedProxyMode(this.defaultProxyMode); + ScopedProxyMode proxyMode = (ScopedProxyMode) attributes.get("proxyMode"); + if (proxyMode == null || proxyMode == ScopedProxyMode.DEFAULT) { + proxyMode = this.defaultProxyMode; + } + metadata.setScopedProxyMode(proxyMode); } } return metadata;