Skip to content

MBeanExporter.setExcludedBeans does not work properly on FactoryBeans [SPR-5926] #10595

Closed
@spring-projects-issues

Description

@spring-projects-issues

Celal Ziftci opened SPR-5926 and commented

Inside the MBeanExporter.autodetect(AutodetectCallback) method, there is a check as follows:

<code>
String[] beanNames = this.beanFactory.getBeanNamesForType(Object.class, true, this.allowEagerInit);
...
if (!isExcluded(beanName)) {
...
}
</code>

Here, the bean names for the factory beans are returned with a ampersand in front (like &someBean), and when the MBeanExporter is used in Spring config with excludedBeans set, one has to use smth like this to get the factoryBean created beans excluded:

<code>
<bean class="org.springframework.jmx.MBeanExporter">
<property name="excludedBeans" value="&someBean" />
</bean>
</code>
So all in all, the framework should know how to handle factory beans and the beans created via them.


Referenced from: commits 566eeba

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions