@@ -67,11 +67,11 @@ public abstract class NamedContextFactory<C extends NamedContextFactory.Specific
6767
6868 private final Map <String , GenericApplicationContext > contexts = new ConcurrentHashMap <>();
6969
70- private Map <String , C > configurations = new ConcurrentHashMap <>();
70+ private final Map <String , C > configurations = new ConcurrentHashMap <>();
7171
7272 private ApplicationContext parent ;
7373
74- private Class <?> defaultConfigType ;
74+ private final Class <?> defaultConfigType ;
7575
7676 public NamedContextFactory (Class <?> defaultConfigType , String propertySourceName , String propertyName ) {
7777 this (defaultConfigType , propertySourceName , propertyName , new HashMap <>());
@@ -222,11 +222,9 @@ public <T> T getInstance(String name, Class<?> clazz, Class<?>... generics) {
222222 public <T > T getInstance (String name , ResolvableType type ) {
223223 GenericApplicationContext context = getContext (name );
224224 String [] beanNames = BeanFactoryUtils .beanNamesForTypeIncludingAncestors (context , type );
225- if (beanNames .length > 0 ) {
226- for (String beanName : beanNames ) {
227- if (context .isTypeMatch (beanName , type )) {
228- return (T ) context .getBean (beanName );
229- }
225+ for (String beanName : beanNames ) {
226+ if (context .isTypeMatch (beanName , type )) {
227+ return (T ) context .getBean (beanName );
230228 }
231229 }
232230 return null ;
0 commit comments