catching and ignoring Exception

This commit is contained in:
Mark Fisher
2011-11-22 22:00:35 -05:00
parent 38743d1c87
commit 02526ec6c0

View File

@@ -16,6 +16,7 @@ package org.springframework.integration.groovy.config;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.Lifecycle;
@@ -86,11 +87,17 @@ public class GroovyControlBusFactoryBean extends AbstractSimpleMessageHandlerFac
if (this.beanFactory != null) {
for (String name : this.beanFactory.getBeanDefinitionNames()) {
if (!this.beanFactory.getBeanDefinition(name).isAbstract()) {
Object bean = this.beanFactory.getBean(name);
if (bean instanceof Lifecycle ||
bean instanceof CustomizableThreadCreator ||
(AnnotationUtils.findAnnotation(bean.getClass(), ManagedResource.class) != null)) {
variables.put(name, bean);
try {
Object bean = this.beanFactory.getBean(name);
if (bean instanceof Lifecycle ||
bean instanceof CustomizableThreadCreator ||
(AnnotationUtils.findAnnotation(bean.getClass(), ManagedResource.class) != null)) {
variables.put(name, bean);
}
}
catch (BeanCreationException e) {
// might be a custom scope bean lacking required context
// ignore, and continue the loop iteration
}
}
}