Browse Source

Merge branch '5.1.x'

pull/22737/head
Juergen Hoeller 7 years ago
parent
commit
d39e3cc0ba
  1. 4
      spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java
  2. 8
      spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
  3. 2
      spring-context/src/main/java/org/springframework/context/annotation/Configuration.java

4
spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java

@ -243,7 +243,7 @@ public interface ListableBeanFactory extends BeanFactory { @@ -243,7 +243,7 @@ public interface ListableBeanFactory extends BeanFactory {
throws BeansException;
/**
* Find all names of beans whose {@code Class} has the supplied {@link Annotation}
* Find all names of beans which are annotated with the supplied {@link Annotation}
* type, without creating corresponding bean instances yet.
* <p>Note that this method considers objects created by FactoryBeans, which means
* that FactoryBeans will get initialized in order to determine their object type.
@ -256,7 +256,7 @@ public interface ListableBeanFactory extends BeanFactory { @@ -256,7 +256,7 @@ public interface ListableBeanFactory extends BeanFactory {
String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType);
/**
* Find all beans whose {@code Class} has the supplied {@link Annotation} type,
* Find all beans which are annotated with the supplied {@link Annotation} type,
* returning a Map of bean names with corresponding bean instances.
* <p>Note that this method considers objects created by FactoryBeans, which means
* that FactoryBeans will get initialized in order to determine their object type.

8
spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

@ -658,12 +658,6 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @@ -658,12 +658,6 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
return result;
}
/**
* Find a {@link Annotation} of {@code annotationType} on the specified
* bean, traversing its interfaces and super classes if no annotation can be
* found on the given class itself, as well as checking its raw bean class
* if not found on the exposed bean reference (e.g. in case of a proxy).
*/
@Override
@Nullable
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
@ -686,6 +680,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @@ -686,6 +680,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
}
if (containsBeanDefinition(beanName)) {
RootBeanDefinition bd = getMergedLocalBeanDefinition(beanName);
// Check raw bean class, e.g. in case of a proxy.
if (bd.hasBeanClass()) {
Class<?> beanClass = bd.getBeanClass();
if (beanClass != beanType) {
@ -696,6 +691,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @@ -696,6 +691,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
}
}
}
// Check annotations declared on factory method, if any.
Method factoryMethod = bd.getResolvedFactoryMethod();
if (factoryMethod != null) {
MergedAnnotation<A> annotation =

2
spring-context/src/main/java/org/springframework/context/annotation/Configuration.java

@ -433,7 +433,7 @@ public @interface Configuration { @@ -433,7 +433,7 @@ public @interface Configuration {
* is registered as a traditional XML bean definition, the name/id of the bean
* element will take precedence.
* @return the explicit component name, if any (or empty String otherwise)
* @see org.springframework.beans.factory.support.DefaultBeanNameGenerator
* @see AnnotationBeanNameGenerator
*/
@AliasFor(annotation = Component.class)
String value() default "";

Loading…
Cancel
Save