Skip to content

Consider favoring ObjectProvider#getIfAvailable #15821

Open
@jzheaux

Description

@jzheaux

Given #15816, it may be easier to make Spring Security's bean resolution policy more consistent.

Reports like #15751 and #15538 make it clear that the existing behavior in some parts of Spring Security is surprising. To alleviate that, we can favor ObjectProvider#getIfAvailable. This is already an improvement over getBeanOrNull since it also supports the @Primary annotation, simplifying the remediation for duplicate beans.

Because getIfAvailable throws an exception when there are multiple candidate beans and getIfUnique does not, this is not a passive change, so it would need to happen in Spring Security 7 or later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: configAn issue in spring-security-configtype: breaks-passivityA change that breaks passivity with the previous releasetype: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions