Polishing

This commit is contained in:
Juergen Hoeller
2018-08-10 18:00:17 +02:00
parent 73dfa9a968
commit 687d350b57
9 changed files with 77 additions and 67 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2018 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.
@@ -80,9 +80,8 @@ public class InjectionMetadata {
Collection<InjectedElement> elementsToIterate =
(this.checkedElements != null ? this.checkedElements : this.injectedElements);
if (!elementsToIterate.isEmpty()) {
boolean debug = logger.isDebugEnabled();
for (InjectedElement element : elementsToIterate) {
if (debug) {
if (logger.isDebugEnabled()) {
logger.debug("Processing injected element of bean '" + beanName + "': " + element);
}
element.inject(target, beanName, pvs);
@@ -109,7 +108,10 @@ public class InjectionMetadata {
}
public static abstract class InjectedElement {
/**
* A single injected element.
*/
public abstract static class InjectedElement {
protected final Member member;
@@ -216,6 +218,7 @@ public class InjectionMetadata {
}
/**
* Clear property skipping for this element.
* @since 3.2.13
*/
protected void clearPropertySkipping(PropertyValues pvs) {

View File

@@ -541,29 +541,29 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
@Override
public String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType) {
List<String> results = new ArrayList<String>();
List<String> result = new ArrayList<String>();
for (String beanName : this.beanDefinitionNames) {
BeanDefinition beanDefinition = getBeanDefinition(beanName);
if (!beanDefinition.isAbstract() && findAnnotationOnBean(beanName, annotationType) != null) {
results.add(beanName);
result.add(beanName);
}
}
for (String beanName : this.manualSingletonNames) {
if (!results.contains(beanName) && findAnnotationOnBean(beanName, annotationType) != null) {
results.add(beanName);
if (!result.contains(beanName) && findAnnotationOnBean(beanName, annotationType) != null) {
result.add(beanName);
}
}
return StringUtils.toStringArray(results);
return StringUtils.toStringArray(result);
}
@Override
public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) {
String[] beanNames = getBeanNamesForAnnotation(annotationType);
Map<String, Object> results = new LinkedHashMap<String, Object>(beanNames.length);
Map<String, Object> result = new LinkedHashMap<String, Object>(beanNames.length);
for (String beanName : beanNames) {
results.put(beanName, getBean(beanName));
result.put(beanName, getBean(beanName));
}
return results;
return result;
}
/**