@ -26,9 +26,11 @@ import java.lang.reflect.Type;
import java.security.AccessController ;
import java.security.AccessController ;
import java.security.PrivilegedAction ;
import java.security.PrivilegedAction ;
import java.util.ArrayList ;
import java.util.ArrayList ;
import java.util.Arrays ;
import java.util.Collection ;
import java.util.Collection ;
import java.util.HashMap ;
import java.util.HashMap ;
import java.util.LinkedHashMap ;
import java.util.LinkedHashMap ;
import java.util.LinkedHashSet ;
import java.util.List ;
import java.util.List ;
import java.util.Map ;
import java.util.Map ;
import java.util.Set ;
import java.util.Set ;
@ -404,14 +406,11 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
}
}
public Map < String , Object > getBeansWithAnnotation ( Class < ? extends Annotation > annotationType ) {
public Map < String , Object > getBeansWithAnnotation ( Class < ? extends Annotation > annotationType ) {
return getBeansWithAnnotation ( annotationType , true , true ) ;
Set < String > beanNames = new LinkedHashSet < String > ( getBeanDefinitionCount ( ) ) ;
}
beanNames . addAll ( Arrays . asList ( getBeanDefinitionNames ( ) ) ) ;
beanNames . addAll ( Arrays . asList ( getSingletonNames ( ) ) ) ;
public Map < String , Object > getBeansWithAnnotation (
Class < ? extends Annotation > annotationType , boolean includeNonSingletons , boolean allowEagerInit ) {
Map < String , Object > results = new LinkedHashMap < String , Object > ( ) ;
Map < String , Object > results = new LinkedHashMap < String , Object > ( ) ;
for ( String beanName : getBeanNamesForType ( Object . class , includeNonSingletons , allowEagerInit ) ) {
for ( String beanName : beanNames ) {
if ( findAnnotationOnBean ( beanName , annotationType ) ! = null ) {
if ( findAnnotationOnBean ( beanName , annotationType ) ! = null ) {
results . put ( beanName , getBean ( beanName ) ) ;
results . put ( beanName , getBean ( beanName ) ) ;
}
}