fixed NPE due to the missing class name from BeanDefinition
This commit is contained in:
Oleg Zhurakousky
2011-12-20 15:34:29 -05:00
committed by Mark Fisher
parent df0e6bd51b
commit 03754b917a
2 changed files with 57 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.core.PriorityOrdered;
import org.springframework.integration.monitor.IntegrationMBeanExporter;
import org.springframework.jmx.export.MBeanExporter;
import org.springframework.util.StringUtils;
/**
* Most likely a temporary class mainly needed to address issue described in INT-2307.
@@ -66,10 +67,13 @@ class MBeanExporterHelper implements BeanFactoryPostProcessor, BeanPostProcessor
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
for (String beanName : beanDefinitionNames) {
BeanDefinition bd = beanFactory.getBeanDefinition(beanName);
BeanDefinition bd = beanFactory.getMergedBeanDefinition(beanName);
String className = bd.getBeanClassName();
if (className.startsWith(SI_ROOT_PACKAGE) && !(className.endsWith(IntegrationMBeanExporter.class.getName()))){
siBeanNames.add(beanName);
if (StringUtils.hasText(className)){
if (className.startsWith(SI_ROOT_PACKAGE) && !(className.endsWith(IntegrationMBeanExporter.class.getName()))){
siBeanNames.add(beanName);
}
}
}
}