Consider favoring ObjectProvider#getIfAvailable #15821
Labels
in: config
An issue in spring-security-config
type: breaks-passivity
A change that breaks passivity with the previous release
type: enhancement
A general enhancement
Milestone
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 overgetBeanOrNull
since it also supports the@Primary
annotation, simplifying the remediation for duplicate beans.Because
getIfAvailable
throws an exception when there are multiple candidate beans andgetIfUnique
does not, this is not a passive change, so it would need to happen in Spring Security 7 or later.The text was updated successfully, but these errors were encountered: