Skip to content

Revisit @Configuration(proxyBeanMethods = false) with qualified injection points #23887

Closed
@snicoll

Description

@snicoll

This relates to #23839

We've switched DelegatingWebMvcConfiguration to disable method proxying and there are a number of side effects that aren't currently covered.

requestMappingHandlerAdapter takes a mvcContentNegotiationManager, mvcConversionService and mvcValidator. These are "qualified" in the aim of calling the related method on the same class.

The problem with this approach is that if any of those types are already exposed with a @Primary bean, the context will not even attempt to look for a candidate (and therefore will not invoke the dedicated bean factory method if necessary).

A concrete illustration of this problem for mvcConverter can be found in spring-projects/spring-boot#18672. A fix is to add a @Qualifier to teach the context the qualified bean is actually required and the context should attempt to look it up.

This seems to be working as expected (although with more metadata than it should be ideally) but given that no tests broke, I can only assume this use case isn't covered by tests at the moment. The purpose of this issue is to revisit this support, add missing tests and eventually change our mind with regards to this decision.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions