title: ClientRegistrationRepository Bean is not found
body: <p>I am trying to configure an OAuth2 client using Spring Boot. I have the following dependencies:</p>
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-webflux&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-oauth2-client&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-oauth2-jose&lt;/artifactId&gt;
      &lt;/dependency&gt;
  </code></pre>
  <p>And I have added these properties to my application.yaml:</p>
  <pre><code>  security:
      oauth2:
        client:
          registration:
            azure:
              client-id: ****
              client-secret: ****
              authorization-grant-type: client_credentials
          provider:
            azure:
              authorization-uri: https://login.microsoftonline.com/2fdb7e27-9b62-44f7-a0fe-9836eaa1f161/oauth2/v2.0/authorize
              token-uri: https://login.microsoftonline.com/2fdb7e27-9b62-44f7-a0fe-9836eaa1f161/oauth2/v2.0/token
              jwk-set-uri: https://login.microsoftonline.com/2fdb7e27-9b62-44f7-a0fe-9836eaa1f161/discovery/v2.0/keys
  </code></pre>
  <p>As I understand it from the Spring documentation, this should be enough to auto-configure a ClientRegistrationRepository (&quot;Spring Boot 2.x auto-configuration binds each of the properties under spring.security.oauth2.client.registration.[registrationId] to an instance of ClientRegistration and then composes each of the ClientRegistration instance(s) within a ClientRegistrationRepository. The auto-configuration also registers the ClientRegistrationRepository as a @Bean in the ApplicationContext so that it is available for dependency-injection, if needed by the application.&quot;.</p>
  <p>I have the following code:</p>
  <pre><code>package com.sky.bnc.azurespring
  
  import org.springframework.context.annotation.Bean
  import org.springframework.context.annotation.Configuration
  import org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager
  import org.springframework.security.oauth2.client.OAuth2AuthorizedClientProviderBuilder
  import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository
  import org.springframework.security.oauth2.client.web.DefaultOAuth2AuthorizedClientManager
  import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository
  import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction
  import org.springframework.web.reactive.function.client.WebClient
  
  @Configuration
  class WebConfiguration {
  
      @Bean
      fun authorizedClientManager(clientRegistrationRepository: ClientRegistrationRepository, authorizedClientRepository: OAuth2AuthorizedClientRepository): OAuth2AuthorizedClientManager {
          val authorizedClientProvider = OAuth2AuthorizedClientProviderBuilder
                  .builder()
                  .authorizationCode()
                  .refreshToken()
                  .clientCredentials()
                  .build()
  
          val authorizedClientManager = DefaultOAuth2AuthorizedClientManager(clientRegistrationRepository, authorizedClientRepository)
          authorizedClientManager.setAuthorizedClientProvider(authorizedClientProvider)
  
          return authorizedClientManager
      }
  
      @Bean
      fun webClient(authorizedClientManager: OAuth2AuthorizedClientManager): WebClient {
          val oauth2Client = ServletOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientManager)
          oauth2Client.setDefaultClientRegistrationId(&quot;azure&quot;)
  
          return WebClient
                  .builder()
                  .apply(oauth2Client.oauth2Configuration())
                  .build()
      }
  }
  </code></pre>
  <p>But when I try and run the application I get this error:</p>
  <pre><code>APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  Parameter 0 of method authorizedClientManager in com.sky.bnc.azurespring.WebConfiguration required a bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' that could not be found.
  
  
  Action:
  
  Consider defining a bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' in your configuration.
  
  
  Process finished with exit code 1
  </code></pre>
  <p>I don't understand what the problem is, I have followed many examples and it seems like it should just be working.</p>