title: spring-boot ReactiveClientRegistrationRepository not found
body: <p>Environment: <strong>Spring Boot 2.3.1, Java 11</strong></p>
  <p>I have tried out a few things already (also comparing with the sample-app by spring), but so far I have been unsuccessful in creating a <code>WebClient</code> that requires a <code>ReactiveClientRegistrationRepository</code>.</p>
  <p>I get the following exception when starting up my spring-boot application:</p>
  <pre><code>required a bean of type 'org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository'
  </code></pre>
  <p>The way I understand spring-boot-autoconfigure it should use the <code>ReactiveOAuth2ClientAutoConfiguration</code>, as in the yml-file the required properties are given.</p>
  <p>Following some code-snippets, I can provide more if something is missing to get the whole context</p>
  <p>Main-Class</p>
  <pre><code>@Slf4j
  @SpringBootApplication
  @EnableConfigurationProperties(MyAppConfigurationProperties.class)
  public class MyApp{
  
      public static void main(final String[] args) {
          SpringApplication.run(MyApp.class, args);
      }
  }
  </code></pre>
  <p>Configuration:</p>
  <pre><code>@Configuration
  //@Import(ReactiveOAuth2ClientAutoConfiguration.class) // in the test it works with this, but should not be required: spring-boot-autoconfigure
  public class MyRestClientConfig {
  
    @Bean
      WebClient myWebClient(WebClient.Builder builder, ReactiveClientRegistrationRepository clientRegistrations) {
  //content not relevant to this problem
  }
  }
  </code></pre>
  <p>Configuration for security</p>
  <pre><code>@EnableGlobalMethodSecurity(securedEnabled = true)
  @EnableWebSecurity
  @EnableWebFluxSecurity
  public class SecurityConfig {
  }
  </code></pre>
  <p>application.yml</p>
  <pre><code>spring:
    security:
      oauth2:
        client:
          registration:
            providerid:
              authorization-grant-type: &quot;client_credentials&quot;
              client-id: &quot;myClientId&quot;
              client-secret: &quot;mySecret&quot;
              user-info-authentication-method: header
          provider:
            providerid:
              token-uri: &quot;working token-uri&quot;
  </code></pre>
  <p>I tried with different dependencies, so some may not be required. Which dependencies are actually required?</p>
  <p>pom.xml</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.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.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-autoconfigure&lt;/artifactId&gt;
          &lt;/dependency&gt;
  &lt;!--        &lt;dependency&gt;--&gt;
  &lt;!--            &lt;groupId&gt;org.springframework.security.oauth.boot&lt;/groupId&gt;--&gt;
  &lt;!--            &lt;artifactId&gt;spring-security-oauth2-autoconfigure&lt;/artifactId&gt;--&gt;
  &lt;!--        &lt;/dependency&gt;--&gt;
          &lt;!--        &lt;dependency&gt;--&gt;
          &lt;!--            &lt;groupId&gt;org.springframework.security.oauth&lt;/groupId&gt;--&gt;
          &lt;!--            &lt;artifactId&gt;spring-security-oauth2&lt;/artifactId&gt;--&gt;
          &lt;!--        &lt;/dependency&gt;--&gt;
  &lt;!--        &lt;dependency&gt;--&gt;
  &lt;!--            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;--&gt;
  &lt;!--            &lt;artifactId&gt;spring-boot-starter-oauth2-client&lt;/artifactId&gt;--&gt;
  &lt;!--        &lt;/dependency&gt;--&gt;
  &lt;!--        &lt;dependency&gt;--&gt;
  &lt;!--            &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;--&gt;
  &lt;!--            &lt;artifactId&gt;spring-security-oauth2-core&lt;/artifactId&gt;--&gt;
  &lt;!--        &lt;/dependency&gt;--&gt;
  &lt;!--        &lt;dependency&gt;--&gt;
  &lt;!--            &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;--&gt;
  &lt;!--            &lt;artifactId&gt;spring-security-oauth2-jose&lt;/artifactId&gt;--&gt;
  &lt;!--        &lt;/dependency&gt;--&gt;
  &lt;!--        &lt;dependency&gt;--&gt;
  &lt;!--            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;--&gt;
  &lt;!--            &lt;artifactId&gt;spring-boot-starter-webflux&lt;/artifactId&gt;--&gt;
  &lt;!--        &lt;/dependency&gt;--&gt;
  </code></pre>
  <p>In an integration-test the Spring-Boot-Application starts up</p>
  <pre><code>@EnableConfigurationProperties
  @Import(ReactiveOAuth2ClientAutoConfiguration.class)  // in the test it works with this, but should not be required: spring-boot-autoconfigure, can be omitted if added in MyRestClientConfig
  @ComponentScan(basePackages = &quot;com.mycompany&quot;)
  public class ManualClientTester {
  }
  </code></pre>
  <p><strong>EDIT 1:</strong>
  Debug of Positive Matches for Autoconfiguration</p>
  <p>In test where it works:</p>
  <pre><code>============================
  CONDITIONS EVALUATION REPORT
  ============================
  
  
  Positive matches:
  -----------------
     ReactiveOAuth2ClientAutoConfiguration matched:
        - @ConditionalOnClass found required classes 'reactor.core.publisher.Flux', 'org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity', 'org.springframework.security.oauth2.client.registration.ClientRegistration' (OnClassCondition)
        - NoneNestedConditions 0 matched 1 did not; NestedCondition on ReactiveOAuth2ClientAutoConfiguration.NonServletApplicationCondition.ServletApplicationCondition not a servlet web application (ReactiveOAuth2ClientAutoConfiguration.NonServletApplicationCondition)
  
     ReactiveOAuth2ClientConfigurations.ReactiveClientRegistrationRepositoryConfiguration matched:
        - OAuth2 Clients Configured Condition found registered clients myClientId (ClientsConfiguredCondition)
        - @ConditionalOnMissingBean (types: org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository; SearchStrategy: all) did not find any beans (OnBeanCondition)
  
     ReactiveOAuth2ClientConfigurations.ReactiveOAuth2ClientConfiguration matched:
        - @ConditionalOnBean (types: org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository; SearchStrategy: all) found bean 'clientRegistrationRepository' (OnBeanCondition)
  
     ReactiveOAuth2ClientConfigurations.ReactiveOAuth2ClientConfiguration#authorizedClientRepository matched:
        - @ConditionalOnMissingBean (types: org.springframework.security.oauth2.client.web.server.ServerOAuth2AuthorizedClientRepository; SearchStrategy: all) did not find any beans (OnBeanCondition)
  
     ReactiveOAuth2ClientConfigurations.ReactiveOAuth2ClientConfiguration#authorizedClientService matched:
        - @ConditionalOnMissingBean (types: org.springframework.security.oauth2.client.ReactiveOAuth2AuthorizedClientService; SearchStrategy: all) did not find any beans (OnBeanCondition)
  </code></pre>
  <p>When starting my spring boot application:</p>
  <pre><code>============================
  CONDITIONS EVALUATION REPORT
  ============================
  
  Negative matches:
  -----------------
  
     ReactiveOAuth2ClientAutoConfiguration:
        Did not match:
           - NoneNestedConditions 1 matched 0 did not; NestedCondition on ReactiveOAuth2ClientAutoConfiguration.NonServletApplicationCondition.ServletApplicationCondition found 'session' scope (ReactiveOAuth2ClientAutoConfiguration.NonServletApplicationCondition)
        Matched:
           - @ConditionalOnClass found required classes 'reactor.core.publisher.Flux', 'org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity', 'org.springframework.security.oauth2.client.registration.ClientRegistration' (OnClassCondition)
  
  </code></pre>
  <p><strong>EDIT 2:</strong>
  After changing as suggested, I have now the following:</p>
  <pre><code>@EnableReactiveMethodSecurity
  @EnableWebFluxSecurity
  public class SecurityConfig {
  }
  </code></pre>
  <p>pom.xml</p>
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-oauth2-client&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;
  </code></pre>
  <p>Furthermore all used versions of spring-projects:</p>
  <pre><code>    &lt;spring-amqp.version&gt;2.2.7.RELEASE&lt;/spring-amqp.version&gt;
      &lt;spring-batch.version&gt;4.2.4.RELEASE&lt;/spring-batch.version&gt;
      &lt;spring-boot.version&gt;2.3.1.RELEASE&lt;/spring-boot.version&gt;
      &lt;spring-data-releasetrain.version&gt;Neumann-SR1&lt;/spring-data-releasetrain.version&gt;
      &lt;spring-framework.version&gt;5.2.7.RELEASE&lt;/spring-framework.version&gt;
      &lt;spring-hateoas.version&gt;1.1.0.RELEASE&lt;/spring-hateoas.version&gt;
      &lt;spring-integration.version&gt;5.3.1.RELEASE&lt;/spring-integration.version&gt;
      &lt;spring-kafka.version&gt;2.5.2.RELEASE&lt;/spring-kafka.version&gt;
      &lt;spring-ldap.version&gt;2.3.3.RELEASE&lt;/spring-ldap.version&gt;
      &lt;spring-restdocs.version&gt;2.0.4.RELEASE&lt;/spring-restdocs.version&gt;
      &lt;spring-retry.version&gt;1.2.5.RELEASE&lt;/spring-retry.version&gt;
      &lt;spring-security.version&gt;5.3.3.RELEASE&lt;/spring-security.version&gt;
      &lt;spring-session-bom.version&gt;Dragonfruit-RELEASE&lt;/spring-session-bom.version&gt;
      &lt;spring-ws.version&gt;3.0.9.RELEASE&lt;/spring-ws.version&gt;
      &lt;spring.boot.version&gt;2.3.1.RELEASE&lt;/spring.boot.version&gt;
      &lt;spring.cloud.version&gt;Hoxton.SR5&lt;/spring.cloud.version&gt;
  </code></pre>
  <p>The problem still exists.</p>