I'm totally new to the concept of spring boot IoC, and @Bean
Let's say this code is implemented
@SpringBootApplication
public class MyApplication{
@Bean
public WebClient rest(ReactiveClientRegistrationRepository clients,
ServerOAuth2AuthorizedClientRepository authz) {
You see here, there is only 1 class that implements the interface ReactiveClientRegistrationRepository
so my correct guess is if there's only one class that implements it, then that would be automatically autowired
to the clients
parameter
public final class InMemoryReactiveClientRegistrationRepository
implements ReactiveClientRegistrationRepository, Iterable<ClientRegistration> {
On the other hand, ServerOAuth2AuthorizedClientRepository
is implemented by 3 different classes namely
public final class AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository
implements ServerOAuth2AuthorizedClientRepository {
public class UnAuthenticatedServerOAuth2AuthorizedClientRepository implements ServerOAuth2AuthorizedClientRepository {
public final class WebSessionServerOAuth2AuthorizedClientRepository
implements ServerOAuth2AuthorizedClientRepository {
Upon debugging, the class that get picked up is AuthenticatedPrincipalServerOAuth2AuthorizedClientRepository
How does spring boot framework knows which is which? I think there would be bean conflicts such as in this question Spring boot autowiring an interface with multiple implementations