Describe the bug
When having multiple PasswordEncoder declared as beans, Spring Authorization Server ignores the @Primary hint and fails to start because it finds multiple beans.
This behaviour is present since the beginning of the project. We’re using 0.4.5 but the reproducer joined below demonstrates the same problem with version 1.2.4.
To Reproduce
Declare multiple PasswordEncorder as components with one as @Primary
@Bean
fun bcryptPasswordEncoder(): PasswordEncoder {
return BCryptPasswordEncoder()
}
@Bean
@Primary
fun delegatingPasswordEncoder(): PasswordEncoder {
return PasswordEncoderFactories.createDelegatingPasswordEncoder()
}
Expected behavior
The component declared as @Primary should be used.
Sample
Reproducer available here -> https://gitlab.com/maltcommunity/public/oss/spring-authorization-server-bug-reproducer/