Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ManagementContextConfiguration is meta-annotated with @Configuration(proxyBeanMethods=false) which does not disable proxying #23301

Closed
dsyer opened this issue Sep 14, 2020 · 2 comments
Labels
type: bug A general bug
Milestone

Comments

@dsyer
Copy link
Member

dsyer commented Sep 14, 2020

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 14, 2020
@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 14, 2020
@philwebb philwebb added this to the 2.4.x milestone Sep 14, 2020
@philwebb
Copy link
Member

philwebb commented Sep 14, 2020

See #9068 for the initial change

@wilkinsona
Copy link
Member

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.

@wilkinsona wilkinsona changed the title Some @ManagementContextConfiguration are not marked as proxyBeanMethods = false @ManagementContextConfiguration is meta-annotated with @Configuration(proxyBeanMethods=false) which does not disable proxying Sep 15, 2020
@wilkinsona wilkinsona added type: bug A general bug and removed type: enhancement A general enhancement labels Sep 15, 2020
@wilkinsona wilkinsona modified the milestones: 2.4.x, 2.2.x Sep 15, 2020
@wilkinsona wilkinsona modified the milestones: 2.2.x, 2.2.10 Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants