Internal to many of Spring Security's configuration classes is a technique for ensuring that it only uses beans with a unique instance in the application context.
Spring Framework's ObjectProvider exposes an API for this kind of thing and it would be interesting to see how many places we could replace this custom code using ApplicationContext#getBeanProvider.
Comment From: ngocnhan-tran1996
@jzheaux
Can you assign me this task?
Comment From: jzheaux
Yes, @ngocnhan-tran1996, thank you for volunteering.
As part of making this change, I'd recommend ensuring that all test cases are present for cases where there is no bean, one bean, and multiple beans. This will make it clear that replacing getBeanOrNull with ObjectProvider hasn't changed behavior.