Параметру 0 метода websocketRoutingFilter в org.springframework.cloud.gateway.config.GatewayAutoConfiguration требуется компонент типа - PullRequest
0 голосов
/ 21 декабря 2018

Я разрабатываю код, взяв ссылку из: https://piotrminkowski.wordpress.com/2018/04/26/quick-guide-to-microservices-with-spring-boot-2-0-eureka-and-spring-cloud/. В этом примере я использую Spring Boot V 2.1.1.RELEASE и spring-cloud-зависимости как Finchley.RELEASE.

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Finchley.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Я получаю ошибку ниже при запуске gateway-service:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-12-21 19:59:47 ERROR [gateway-service,,,] 

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

Description:

Parameter 0 of method websocketRoutingFilter in org.springframework.cloud.gateway.config.GatewayAutoConfiguration required a bean of type 'org.springframework.web.reactive.socket.client.WebSocketClient' that could not be found.

The following candidates were found but could not be injected:
    - Bean method 'reactorNettyWebSocketClient' in 'GatewayAutoConfiguration.NettyConfiguration' not loaded because @ConditionalOnClass did not find required class 'reactor.ipc.netty.http.client.HttpClient'


Action:

Consider revisiting the entries above or defining a bean of type 'org.springframework.web.reactive.socket.client.WebSocketClient' in your configuration.

enter image description here

И также получаю ошибку ниже при запуске proxy-service.Как я могу решить эту проблему?

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-12-21 20:02:19 ERROR [proxy-service,,,] 

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

Description:

The bean 'proxyRequestHelper', defined in class path resource [org/springframework/cloud/netflix/zuul/ZuulProxyAutoConfiguration$NoActuatorConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/cloud/netflix/zuul/ZuulProxyAutoConfiguration$EndpointConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

GatewayApplication.java

@SpringBootApplication
@EnableDiscoveryClient
public class GatewayApplication {
    public static void main(String[] args) {
        SpringApplication.run(GatewayApplication.class, args);
    }
}

bootstrap.yml

spring:
  application:
    name: gateway-service
  cloud:
    config:
      uri: http://localhost:8088

ProxyApplication.java

@SpringBootApplication
@EnableZuulProxy
@EnableSwagger2
public class ProxyApplication {
    public static void main(String[] args) {
        SpringApplication.run(ProxyApplication.class, args);
    }
}

ProxyApi.java

@Configuration
public class ProxyApi {

    @Autowired
    ZuulProperties properties;

    @Primary
    @Bean
    public SwaggerResourcesProvider swaggerResourcesProvider() {
        return () -> {
            List<SwaggerResource> resources = new ArrayList<>();
            properties.getRoutes().values().stream()
                    .forEach(route -> resources.add(createResource(route.getServiceId(), route.getId(), "2.0")));
            return resources;
        };
    }

    private SwaggerResource createResource(String name, String location, String version) {
        SwaggerResource swaggerResource = new SwaggerResource();
        swaggerResource.setName(name);
        swaggerResource.setLocation("/" + location + "/v2/api-docs");
        swaggerResource.setSwaggerVersion(version);
        return swaggerResource;
    }
}

Я видел https://github.com/spring-cloud/spring-cloud-gateway/issues/319,, но я все еще хочу использовать Spring BootV * +1041 *. * * тысяча сорок-два

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...