@Override public <T> T find(Class<T> type) { try { return factory.getBean(type); } catch (NoSuchBeanDefinitionException e) { try { Map<String, T> beans = factory.getBeansOfType(type); if (beans.values().isEmpty()) throw new BeanNotFoundFailure(e, type); throw new BeanNotFoundFailure(type, beans.values()); } catch (NoSuchBeanDefinitionException e2) { throw new BeanNotFoundFailure(e2, type); } } }
@Override public <T> T find(Class<T> type) { try { return factory.getBean(type); } catch (NoSuchBeanDefinitionException e) { try { Map<String, T> beans = factory.getBeansOfType(type); if (beans.values().isEmpty()) throw new BeanNotFoundFailure(e, type); throw new BeanNotFoundFailure(type, beans.values()); } catch (NoSuchBeanDefinitionException e2) { throw new BeanNotFoundFailure(e2, type); } } }
@Override public <T> T find(Class<T> type) throws BeanNotFoundFailure { try { return injector.getInstance(type); } catch (ProvisionException e) { throw new BeanNotFoundFailure(e, type); } catch (ConfigurationException e) { try { Set<T> beans = injector.getInstance(Key.get(setOf(TypeLiteral.get(type)))); throw new BeanNotFoundFailure(type, beans); } catch (ConfigurationException e2) { throw new BeanNotFoundFailure(e, type); } } }
@Override public <T> T find(Class<T> type) throws BeanNotFoundFailure { try { return injector.getInstance(type); } catch (ProvisionException e) { throw new BeanNotFoundFailure(e, type); } catch (ConfigurationException e) { try { Set<T> beans = injector.getInstance(Key.get(setOf(TypeLiteral.get(type)))); throw new BeanNotFoundFailure(type, beans); } catch (ConfigurationException e2) { throw new BeanNotFoundFailure(e, type); } } }