Some of the @ManagementContextConfiguration classes are explicitly marked as proxyBeanMethods = false and some are not (e.g. WebMvcEndpointChildContextConfiguration). It seems like Spring doesn't recognize this in a meta-annotation, so it's probably a bug not to declare it explicitly:
Class<WebMvcEndpointChildContextConfiguration> type = WebMvcEndpointChildContextConfiguration.class;
String name = Configuration.class.getName();
System.err.println(new SimpleMetadataReaderFactory().getMetadataReader(type.getName()).getAnnotationMetadata()
.getAllAnnotationAttributes(name).get("proxyBeanMethods"));
System.err.println(new SimpleMetadataReaderFactory().getMetadataReader(type.getName()).getAnnotationMetadata()
.getAnnotationAttributes(name).get("proxyBeanMethods"));
System.err.println(
AnnotatedElementUtils.getMergedAnnotationAttributes(type, name, true, true).get("proxyBeanMethods"));
System.err.println(
AnnotatedElementUtils.findMergedAnnotationAttributes(type, name, true, true).get("proxyBeanMethods"));
prints
[false]
true
true
true
The code path in Spring is the second one (I think), via ConfigurationClassUtils.
Comment From: philwebb
See #9068 for the initial change
Comment From: wilkinsona
I think this should be treated as a bug as the current arrangement doesn't really make sense. We've got proxyBeanMethods=false on a @Configuration meta-annotation, but we also have a proxyBeanMethods attribute on @ManagementContextConfiguration that's an alias for the attribute on @Configuration. The attribute on the meta-annotation should be removed in favour of the aliased attribute.