Ошибка Spring Cloud Gateway в TokenRelayGatewayFilterFactory - PullRequest
1 голос
/ 04 апреля 2020

Я получаю следующую ошибку при запуске Spring Cloud Gateway. Соответствующий файл yml и мои зависимости приведены ниже

    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-04-04 18:28:56.698 ERROR 6944 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method tokenRelayGatewayFilterFactory in org.springframework.cloud.security.oauth2.gateway.TokenRelayAutoConfiguration required a bean of type 'org.springframework.security.oauth2.client.web.server.ServerOAuth2AuthorizedClientRepository' that could not be found.

The following candidates were found but could not be injected:
    - Bean method 'authorizedClientRepository' in 'ReactiveOAuth2ClientConfigurations.ReactiveOAuth2ClientConfiguration' not loaded because @ConditionalOnBean (types: org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository; SearchStrategy: all) did not find any beans of type org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository


Action:

Consider revisiting the entries above or defining a bean of type 'org.springframework.security.oauth2.client.web.server.ServerOAuth2AuthorizedClientRepository' in your configuration.


Process finished with exit code 0

Зависимости:

   <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-gateway</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-oauth2-client</artifactId>
        <version>2.2.6.RELEASE</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-security -->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-security</artifactId>
        <version>1.0.0.RELEASE</version>
    </dependency>

Ниже приведен пример использования yml, который я пытаюсь использовать. Я использую OAuth2.0 и, следовательно, у меня есть tokenrelay

>    application:
>     name: gateway   cloud:
>     gateway:
>       routes:
>         - id: jobpostingModule
>           uri: http://localhost:6084/
>           predicates:
>             - Path=/api/jobpostings/**
>           filters:
>             - TokenRelay=
>           sensitiveHeaders:
...