Merge pull request #206 from markfisher/INT-2164-quickfix-for-2.1

* INT-2164-quickfix-for-2.1:
  catching and ignoring Exception
This commit is contained in:
Mark Fisher
2011-11-23 08:05:10 -05:00

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
}
}
}