Commit 21234b36 authored by Phillip Webb's avatar Phillip Webb

Ensure `JmxEndpoint` beans get context object IDs

Update `EndpointMBeanExporter` to ensure that `JmxEndpoint` as well
as regular `Endpoint` beans are considered when searching the parent
context.

Prior to this commit if the same `JmxEndpoint` was registered in the
both the child and parent context then the `context=` element of the
name wasn't added.

Fixes gh-8152
parent 5dafa3ae
......@@ -283,13 +283,15 @@ public class EndpointMBeanExporter extends MBeanExporter
String beanKey) {
if (applicationContext.getParent() != null) {
try {
this.applicationContext.getParent().getBean(beanKey, Endpoint.class);
return true;
Object bean = this.applicationContext.getParent().getBean(beanKey);
if (bean instanceof Endpoint || bean instanceof JmxEndpoint) {
return true;
}
}
catch (BeansException ex) {
return parentContextContainsSameBean(applicationContext.getParent(),
beanKey);
// Ignore and continue
}
return parentContextContainsSameBean(applicationContext.getParent(), beanKey);
}
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment