@Test void createInstance_multipleStackResourceRegistriesAvailable_throwsException() throws Exception { StackResourceRegistryDetectingResourceIdResolver resourceIdResolver; resourceIdResolver = new StackResourceRegistryDetectingResourceIdResolver(); resourceIdResolver.setBeanFactory(makeListableBeanFactory( makeStackResourceRegistry(), makeStackResourceRegistry())); assertThatThrownBy(resourceIdResolver::afterPropertiesSet) .isInstanceOf(IllegalStateException.class) .hasMessage("Multiple stack resource registries found"); }
@Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { if (!(beanFactory instanceof ListableBeanFactory)) { throw new IllegalStateException("Bean factory must be of type '" + ListableBeanFactory.class.getName() + "'"); } this.beanFactory = (ListableBeanFactory) beanFactory; }
StackResourceRegistryDetectingResourceIdResolver implements ResourceIdResolver, BeanFactoryAware, InitializingBean { @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { if (!(beanFactory instanceof ListableBeanFactory)) { throw new IllegalStateException("Bean factory must be of type '" + ListableBeanFactory.class.getName() + "'"); } this.beanFactory = (ListableBeanFactory) beanFactory; } }
StackResourceRegistryDetectingResourceIdResolver implements ResourceIdResolver, BeanFactoryAware, InitializingBean { @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { if (!(beanFactory instanceof ListableBeanFactory)) { throw new IllegalStateException("Bean factory must be of type '" + ListableBeanFactory.class.getName() + "'"); } this.beanFactory = (ListableBeanFactory) beanFactory; }  }
StackResourceRegistryDetectingResourceIdResolver implements ResourceIdResolver, BeanFactoryAware, InitializingBean { @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { if (!(beanFactory instanceof ListableBeanFactory)) { throw new IllegalStateException("Bean factory must be of type '" + ListableBeanFactory.class.getName() + "'"); } this.beanFactory = (ListableBeanFactory) beanFactory; }  @Override String resolveToPhysicalResourceId(String logicalResourceId); @Override void setBeanFactory(BeanFactory beanFactory); @Override void afterPropertiesSet(); }
StackResourceRegistryDetectingResourceIdResolver implements ResourceIdResolver, BeanFactoryAware, InitializingBean { @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { if (!(beanFactory instanceof ListableBeanFactory)) { throw new IllegalStateException("Bean factory must be of type '" + ListableBeanFactory.class.getName() + "'"); } this.beanFactory = (ListableBeanFactory) beanFactory; }  @Override String resolveToPhysicalResourceId(String logicalResourceId); @Override void setBeanFactory(BeanFactory beanFactory); @Override void afterPropertiesSet();  }