Polishing

This commit is contained in:
Juergen Hoeller 2014-12-01 19:16:31 +01:00
parent fa0ef2d87e
commit c85686ac78
4 changed files with 10 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -140,7 +140,7 @@ public class AnnotationBeanNameGenerator implements BeanNameGenerator {
* <p>The default implementation simply builds a decapitalized version * <p>The default implementation simply builds a decapitalized version
* of the short class name: e.g. "mypackage.MyJdbcDao" -> "myJdbcDao". * of the short class name: e.g. "mypackage.MyJdbcDao" -> "myJdbcDao".
* <p>Note that inner classes will thus have names of the form * <p>Note that inner classes will thus have names of the form
* "outerClassName.innerClassName", which because of the period in the * "outerClassName.InnerClassName", which because of the period in the
* name may be an issue if you are autowiring by name. * name may be an issue if you are autowiring by name.
* @param definition the bean definition to build a bean name for * @param definition the bean definition to build a bean name for
* @return the default bean name (never {@code null}) * @return the default bean name (never {@code null})

View File

@ -214,7 +214,7 @@ public class AnnotationConfigUtils {
if (metadata.isAnnotated(Lazy.class.getName())) { if (metadata.isAnnotated(Lazy.class.getName())) {
abd.setLazyInit(attributesFor(metadata, Lazy.class).getBoolean("value")); abd.setLazyInit(attributesFor(metadata, Lazy.class).getBoolean("value"));
} }
else if (abd.getMetadata().isAnnotated(Lazy.class.getName())) { else if (abd.getMetadata() != metadata && abd.getMetadata().isAnnotated(Lazy.class.getName())) {
abd.setLazyInit(attributesFor(abd.getMetadata(), Lazy.class).getBoolean("value")); abd.setLazyInit(attributesFor(abd.getMetadata(), Lazy.class).getBoolean("value"));
} }

View File

@ -257,9 +257,8 @@ class ConfigurationClassEnhancer {
/** /**
* Enhance a {@link Bean @Bean} method to check the supplied BeanFactory for the * Enhance a {@link Bean @Bean} method to check the supplied BeanFactory for the
* existence of this bean object. * existence of this bean object.
* @throws Throwable as a catch-all for any exception that may be thrown when * @throws Throwable as a catch-all for any exception that may be thrown when invoking the
* invoking the super implementation of the proxied method i.e., the actual * super implementation of the proxied method i.e., the actual {@code @Bean} method
* {@code @Bean} method.
*/ */
@Override @Override
public Object intercept(Object enhancedConfigInstance, Method beanMethod, Object[] beanMethodArgs, public Object intercept(Object enhancedConfigInstance, Method beanMethod, Object[] beanMethodArgs,

View File

@ -228,11 +228,11 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
int registryId = System.identityHashCode(registry); int registryId = System.identityHashCode(registry);
if (this.registriesPostProcessed.contains(registryId)) { if (this.registriesPostProcessed.contains(registryId)) {
throw new IllegalStateException( throw new IllegalStateException(
"postProcessBeanDefinitionRegistry already called for this post-processor against " + registry); "postProcessBeanDefinitionRegistry already called on this post-processor against " + registry);
} }
if (this.factoriesPostProcessed.contains(registryId)) { if (this.factoriesPostProcessed.contains(registryId)) {
throw new IllegalStateException( throw new IllegalStateException(
"postProcessBeanFactory already called for this post-processor against " + registry); "postProcessBeanFactory already called on this post-processor against " + registry);
} }
this.registriesPostProcessed.add(registryId); this.registriesPostProcessed.add(registryId);
@ -248,7 +248,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
int factoryId = System.identityHashCode(beanFactory); int factoryId = System.identityHashCode(beanFactory);
if (this.factoriesPostProcessed.contains(factoryId)) { if (this.factoriesPostProcessed.contains(factoryId)) {
throw new IllegalStateException( throw new IllegalStateException(
"postProcessBeanFactory already called for this post-processor against " + beanFactory); "postProcessBeanFactory already called on this post-processor against " + beanFactory);
} }
this.factoriesPostProcessed.add(factoryId); this.factoriesPostProcessed.add(factoryId);
if (!this.registriesPostProcessed.contains(factoryId)) { if (!this.registriesPostProcessed.contains(factoryId)) {
@ -329,8 +329,8 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
for (String candidateName : newCandidateNames) { for (String candidateName : newCandidateNames) {
if (!oldCandidateNames.contains(candidateName)) { if (!oldCandidateNames.contains(candidateName)) {
BeanDefinition beanDef = registry.getBeanDefinition(candidateName); BeanDefinition beanDef = registry.getBeanDefinition(candidateName);
if (ConfigurationClassUtils.checkConfigurationClassCandidate(beanDef, this.metadataReaderFactory) if (ConfigurationClassUtils.checkConfigurationClassCandidate(beanDef, this.metadataReaderFactory) &&
&& !alreadyParsedClasses.contains(beanDef.getBeanClassName())) { !alreadyParsedClasses.contains(beanDef.getBeanClassName())) {
configCandidates.add(new BeanDefinitionHolder(beanDef, candidateName)); configCandidates.add(new BeanDefinitionHolder(beanDef, candidateName));
} }
} }