搜索
简帛阁>技术文章>springcloud gateway踩大坑了Parameter 0 of method websocketRoutingFilter in org.springframework.cloud.gat

springcloud gateway踩大坑了Parameter 0 of method websocketRoutingFilter in org.springframework.cloud.gat

pom

<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>

只有网关依赖
Spring Boot 版本是 2.1.0.RELEASE,
Spring Clound 版本是Finchley.RELEASE

application.yml

server:
  port: 7001
spring:
  application:
    name: api-geteway
  cloud:
    gateway:
      routes:
      -  id: 163
         uri: http://www.163.com/
         predicates:
           - Path=/163/**

网关转发路径 写死 测试使用

项目启动 异常

2018-11-13 18:12:00.738  WARN 13744 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webHandler' defined in class path resource [org/springframework/boot/autoconfigure/web/reactive/WebFluxAutoConfiguration$EnableWebFluxConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'routePredicateHandlerMapping' defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration.class]: Unsatisfied dependency expressed through method 'routePredicateHandlerMapping' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'filteringWebHandler' defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration.class]: Unsatisfied dependency expressed through method 'filteringWebHandler' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'websocketRoutingFilter' defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration.class]: Unsatisfied dependency expressed through method 'websocketRoutingFilter' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.web.reactive.socket.client.WebSocketClient' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2018-11-13 18:12:00.758  INFO 13744 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-11-13 18:12:00.911 ERROR 13744 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
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.

Disconnected from the target VM, address: '127.0.0.1:52208', transport: 'socket'

Process finished with exit code 1

why?

解决方案:

我使用的Spring Boot 版本是 2.1.0.RELEASE, 使用的Spring Clound 版本是Finchley.RELEASE ,
后找到原因 Spring Clound 版本 Finchley.RELEASE 不兼容 Spring Boot 2.1.0.RELEASE 汗,
Spring Boot 版本改为 2.0.0.RELEASE 网关使用ok

面试题你了解大O符号(bigOnotation)么?你能给出不同数据结构的例子么?大O符号描述了当数据结构里面的元素增加的时候,算法的规模或者是一个渐进上界。大O符号也可用来描述其他的行为,比如:内存
1大O:数步数数步数为了统一描述,大O不关注算法所用的时间,只关注其所用的步数。数组不论多大,读取都只需1步。用大O记法来表示,就是:O(1)很多人将其读作“大O1”,也有些人读成“1数量级”。一般
在描述算法复杂度时,经常用到o(1),o(n),o(logn),o(nlogn)来表示对应算法的时间复杂度,这里进行归纳一下它们代表的含义:这是算法的时空复杂度的表示。不仅仅用于表示时间复杂度,也用
1、时间复杂度o(1),o(n),o(logn),o(nlogn)。算法时间复杂度的时候有说o(1),o(n),o(logn),o(nlogn),这是算法的时空复杂度的表示。不仅仅用于表示时间复杂度,
ps:郁闷纳,一个整形变量,为什么不做一强制转换呢!看过第六轮黑防实验室的两位大侠对Oblog30Access版本的渗透过程,敬佩之情犹如滔滔江水连绵不绝,又如黄河之水一发而不可收拾,尤其是他们把社会
一、阻塞I/O首先,要从你常用的IO操作谈起,比如read和write,通常IO操作都是阻塞I/O的,也就是说当你调用read时,如果没有数据收到,那么线程或者进程就会被挂起,直到收到数据。阻塞的意
优化I/O写在开头读写文件是再普通不过的活动,以至于开发人员往往忽略它们,但是实际上它们确实非常耗时的程序活动互联网世界受限于数据传输速率和繁忙的服务器,响应延迟可能是以毫秒而非秒计量的。当数据传
现状(自下而上)1Oracle数据库,表,序列,存储过程,视图2ibatis框架,映射xml中的sql语句3应用中通过指定字符串的形式获取查询结果目标1置换数据库为PG数据库,迁移数据,表,序列,存储
I/O复用的场合:1客户处理多个描述字时2客户处理多个套接口3服务器处理监听套接口,又要处理已连接套接口4既处理TCP,又处理UDP5处理多个服务或者多个协议套接口上的输入操作:1数据到达网络,分组
流的概念流是一组有顺序的,有起点和终点的字节集合,是对数据传输的总称或抽象,即数据在两设备间的传输称为流,流的本质是数据传输,根据数据传输特性将流抽象为各种类,方便更直观的进行数据操作。根据处理数据类