public <T> T getInstance(String name, Class<T> type) { AnnotationConfigApplicationContext context = getContext(name); if (BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context, type).length > 0) { return context.getBean(type); } return null; }
public <T> ObjectProvider<T> getProvider(String name, Class<T> type) { AnnotationConfigApplicationContext context = getContext(name); return context.getBeanProvider(type); }
@SuppressWarnings("unchecked") public <T> T getInstance(String name, ResolvableType type) { AnnotationConfigApplicationContext context = getContext(name); String[] beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context, type); if (beanNames.length > 0) { for (String beanName : beanNames) { if (context.isTypeMatch(beanName, type)) { return (T) context.getBean(beanName); } } } return null; }
public <T> Map<String, T> getInstances(String name, Class<T> type) { AnnotationConfigApplicationContext context = getContext(name); if (BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context, type).length > 0) { return BeanFactoryUtils.beansOfTypeIncludingAncestors(context, type); } return null; }
@Override protected AnnotationConfigApplicationContext getContext(String name) { return super.getContext(name); }
public <T> T getInstance(String name, Class<T> type) { AnnotationConfigApplicationContext context = getContext(name); if (BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context, type).length > 0) { return context.getBean(type); } return null; }
public <T> ObjectProvider<T> getProvider(String name, Class<T> type) { AnnotationConfigApplicationContext context = getContext(name); return context.getBeanProvider(type); }
@SuppressWarnings("unchecked") public <T> T getInstance(String name, ResolvableType type) { AnnotationConfigApplicationContext context = getContext(name); String[] beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context, type); if (beanNames.length > 0) { for (String beanName : beanNames) { if (context.isTypeMatch(beanName, type)) { return (T) context.getBean(beanName); } } } return null; }
public <T> Map<String, T> getInstances(String name, Class<T> type) { AnnotationConfigApplicationContext context = getContext(name); if (BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context, type).length > 0) { return BeanFactoryUtils.beansOfTypeIncludingAncestors(context, type); } return null; }