diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/Bean.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/Bean.java index 978fe2d890c..143411d31b6 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/Bean.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/Bean.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation; import java.lang.annotation.Documented; @@ -96,8 +97,3 @@ public @interface Bean { String[] dependsOn() default {}; } - -// TODO: test @Lazy @Bean -// TODO: test @Primary @Bean -// TODO: test init/destroy method scenarios -// TODO: test dependsOn diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/Configuration.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/Configuration.java index d62f7374bc5..84d406592fe 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/Configuration.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/Configuration.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation; import java.lang.annotation.Documented; @@ -64,7 +65,3 @@ import org.springframework.stereotype.Component; public @interface Configuration { } - -// TODO: test @Configuration constructor autowiring -// TODO: test @Lazy @Configuration - diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/Import.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/Import.java index 9a5aacfec18..20ac1bf19c4 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/Import.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/Import.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation; import java.lang.annotation.Documented; @@ -42,5 +43,5 @@ public @interface Import { /** * The {@link Configuration} class or classes to import. */ - Class[] value(); + Class[] value(); } diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/Scope.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/Scope.java index a52e0092eb5..558aa461497 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/Scope.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/Scope.java @@ -67,5 +67,5 @@ public @interface Scope { * only in conjunction with a non-singleton, non-prototype {@link #value()}. */ ScopedProxyMode proxyMode() default ScopedProxyMode.NO; - + } diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/StandardScopes.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/StandardScopes.java index e28cc96effe..9aedff08252 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/StandardScopes.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/StandardScopes.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation; @@ -25,6 +26,7 @@ package org.springframework.context.annotation; * * @author Chris Beams * @since 3.0 + * @see Scope */ public class StandardScopes { @@ -39,5 +41,3 @@ public class StandardScopes { public static final String SESSION = "session"; } - -// TODO: move StandardScopes to appropriate package diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AbstractConfigurationClassProcessor.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AbstractConfigurationClassProcessor.java index 040fce41066..aa19cc1338a 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AbstractConfigurationClassProcessor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AbstractConfigurationClassProcessor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import org.springframework.beans.factory.config.BeanDefinition; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AddAnnotationAdapter.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AddAnnotationAdapter.java index e58659ade11..514e2b9e676 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AddAnnotationAdapter.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AddAnnotationAdapter.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import net.sf.cglib.asm.Constants; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AnnotationAdapter.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AnnotationAdapter.java index a2ec5dcb6e2..a1846e2b9c5 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AnnotationAdapter.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AnnotationAdapter.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import org.springframework.asm.AnnotationVisitor; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AsmUtils.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AsmUtils.java index 6e5d9dd85e7..5c7c4b42bc1 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AsmUtils.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/AsmUtils.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import java.io.IOException; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/BeanMethod.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/BeanMethod.java index 9a3284d1ed4..55b7cd5c1b6 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/BeanMethod.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/BeanMethod.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static java.lang.String.*; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/BeanMethodInterceptor.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/BeanMethodInterceptor.java index 3067e7a11e8..e9604b46923 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/BeanMethodInterceptor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/BeanMethodInterceptor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static java.lang.String.*; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClass.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClass.java index 8491e4c8bcc..f88c4ef8bc7 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClass.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClass.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static java.lang.String.*; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassMethodVisitor.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassMethodVisitor.java index 1ec1dc5dbe7..6a0a3c73c4a 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassMethodVisitor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassMethodVisitor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static org.springframework.context.annotation.support.AsmUtils.*; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassPostProcessor.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassPostProcessor.java index 556d81db17a..6461bac68f9 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassPostProcessor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassPostProcessor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static java.lang.String.*; @@ -146,7 +147,7 @@ public class ConfigurationClassPostProcessor extends AbstractConfigurationClassP ConfigurationEnhancer enhancer = new ConfigurationEnhancer(beanFactory); - for(String beanName : configBeanDefs.getBeanDefinitionNames()) { + for (String beanName : configBeanDefs.getBeanDefinitionNames()) { BeanDefinition beanDef = beanFactory.getBeanDefinition(beanName); String configClassName = beanDef.getBeanClassName(); String enhancedClassName = enhancer.enhance(configClassName); diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassVisitor.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassVisitor.java index 4dd8079e027..78fdef59d56 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassVisitor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationClassVisitor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static java.lang.String.*; @@ -144,8 +145,8 @@ class ConfigurationClassVisitor extends ClassAdapter { * {@link ConfigurationClassMethodVisitor}. */ @Override - public MethodVisitor visitMethod(int modifiers, String methodName, String methodDescriptor, String arg3, - String[] arg4) { + public MethodVisitor visitMethod(int modifiers, String methodName, String methodDescriptor, + String arg3, String[] arg4) { return new ConfigurationClassMethodVisitor(configClass, methodName, methodDescriptor, modifiers, classLoader); } diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationEnhancer.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationEnhancer.java index 7d352d1516a..78518b6813b 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationEnhancer.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationEnhancer.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static java.lang.String.*; @@ -141,7 +142,6 @@ class ConfigurationEnhancer { * @return original subclass instance unless superclass is annnotated with @Aspect, in * which case a subclass of the subclass is returned */ - // TODO: try to implement with modifications to AbstractAspectJAdvisorFactory#isAspect private Class nestOneClassDeeperIfAspect(Class superclass, Class origSubclass) { boolean superclassIsAnAspect = false; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationModel.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationModel.java index d297dc2bd47..91d6093995f 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationModel.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationModel.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static java.lang.String.*; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationModelBeanDefinitionReader.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationModelBeanDefinitionReader.java index 63281bebfd0..1d17bcbeffa 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationModelBeanDefinitionReader.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationModelBeanDefinitionReader.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static java.lang.String.*; @@ -63,10 +64,11 @@ class ConfigurationModelBeanDefinitionReader { /** - * Reads {@code model}, registering bean definitions with {@link #registry} based on - * its contents. + * Reads {@code configurationModel}, registering bean definitions with {@link #registry} + * based on its contents. * - * @return number of bean definitions generated + * @return new {@link BeanDefinitionRegistry} containing {@link BeanDefinition}s read + * from the model. */ public BeanDefinitionRegistry loadBeanDefinitions(ConfigurationModel configurationModel) { registry = new SimpleBeanDefinitionRegistry(); @@ -131,9 +133,6 @@ class ConfigurationModelBeanDefinitionReader { Bean bean = method.getRequiredAnnotation(Bean.class); - // TODO: prune defaults - //Configuration defaults = configClass.getMetadata(); - // consider scoping Scope scope = method.getAnnotation(Scope.class); if(scope != null) diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationParser.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationParser.java index 3cf8e7540a6..7e9954c7a40 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationParser.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ConfigurationParser.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import org.springframework.asm.ClassReader; @@ -67,7 +68,7 @@ public class ConfigurationParser { * that this configuration class was configured via XML) */ public void parse(String className, String configurationId) { - + String resourcePath = ClassUtils.convertClassNameToResourcePath(className); ClassReader configClassReader = AsmUtils.newClassReader(Util.getClassAsStream(resourcePath, classLoader)); diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportAnnotationVisitor.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportAnnotationVisitor.java index 5e30e9cb1d6..6253a27eff8 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportAnnotationVisitor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportAnnotationVisitor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static java.lang.String.*; @@ -41,6 +42,7 @@ import org.springframework.util.Assert; * @see ConfigurationClassVisitor */ class ImportAnnotationVisitor extends AnnotationAdapter { + private final ArrayList classesToImport = new ArrayList(); private final ConfigurationModel model; private final ProblemReporter problemReporter; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportStack.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportStack.java index 79dadd58ecc..75a0e7a3961 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportStack.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportStack.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import java.util.Collections; @@ -71,7 +72,6 @@ class ImportStack extends Stack { StringBuilder builder = new StringBuilder(); Iterator iterator = this.iterator(); - while (iterator.hasNext()) { builder.append(iterator.next().getSimpleName()); if (iterator.hasNext()) diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportStackHolder.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportStackHolder.java index c9f65423fab..54a9fe73048 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportStackHolder.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ImportStackHolder.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import org.springframework.context.annotation.Import; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ModelClass.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ModelClass.java index d2e8958dbcb..3e4bac46da4 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ModelClass.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/ModelClass.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static org.springframework.util.ClassUtils.*; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotation.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotation.java index 108a87e0456..c4bf3ec99c7 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotation.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotation.java @@ -13,10 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; +import org.springframework.context.annotation.Configuration; + /** - * Note: the visibility of this interface would be reduced to package-private save for an + * Interface used when dynamically creating mutable instances of annotations associated + * with {@link Configuration} class processing. This functionality is necessary given + * that parsing of Configuration classes is done with ASM. Annotation metadata (including + * attributes) is parsed from the classfiles, and instances of those annotations are + * then created using this interface and its associated utilities. The annotation + * instances are attached to the {@link ConfigurationModel} objects at runtime, namely + * {@link BeanMethod}. This approach is better than the alternative of creating fine-grained + * model representations of all annotations and attributes. It is better to simply attach + * annotation instances and read them as needed. + * + *

Note: the visibility of this interface would be reduced to package-private save for an * obscure restriction of JDK dynamic proxies. * {@link MutableAnnotationUtils#createMutableAnnotation(Class)} creates a proxy based on * two interfaces: this one, and whatever annotation is currently being parsed. The @@ -26,6 +39,9 @@ package org.springframework.context.annotation.support; * not to use this annotation outside this package. * * @author Chris Beams + * @see MutableAnnotationUtils + * @see MutableAnnotationVisitor + * @see MutableAnnotationInvocationHandler */ public interface MutableAnnotation { diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationArrayVisitor.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationArrayVisitor.java index 77c5d14c017..556e12a8c0f 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationArrayVisitor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationArrayVisitor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static org.springframework.context.annotation.support.MutableAnnotationUtils.*; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationInvocationHandler.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationInvocationHandler.java index cbd8aaf0174..1e7eccd5a36 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationInvocationHandler.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationInvocationHandler.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static java.lang.String.*; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationUtils.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationUtils.java index aee3120c5a6..87422cf2f55 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationUtils.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationUtils.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import java.lang.annotation.Annotation; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationVisitor.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationVisitor.java index 33705a4b35c..d71776334bf 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationVisitor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/MutableAnnotationVisitor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static org.springframework.context.annotation.support.MutableAnnotationUtils.*; diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/Util.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/Util.java index 9ef09de974a..ef11761d918 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/support/Util.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/support/Util.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.context.annotation.support; import static java.lang.String.*;