Skip to content

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

Closed

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.

Activity

  1. added
    type: regression
    on Oct 29, 2019
  2. added this to the 5.2.1 milestone on Oct 29, 2019
  3. self-assigned this
    on Oct 29, 2019
  4. changed the title [-]MVC configuration may not use expected infrastructure[/-] [+]Revisit @Configuration(proxyBeanMethods = false) with qualified injection points[/+] on Oct 30, 2019
  5. snicoll commented on Oct 30, 2019

    @snicoll
    MemberAuthor

    This turned out to be a larger affair. Checking our use of @Configuration(proxyBeanMethods = false) when the injection point expect a qualified injection point. Production code seems rather limited at the moment:

    • ProxyTransactionManagementConfiguration
    • DelegatingWebMvcConfiguration
    • DelegatingWebFluxConfiguration
  6. added a commit that references this issue on Oct 30, 2019
    d289a3b
  7. added a commit that references this issue on Sep 17, 2026
    8d88e29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: regression

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions