Spring Cloud Gateway 2.0.0.RELEASE:无法找到名称为Hystrix的GatewayFilterFactory

时间:2018-08-02 07:14:36

标签: spring cloud gateway hystrix

请帮助我

application.properties:

spring.cloud.gateway.discovery.locator.enabled=true
logging.level.org.springframework.cloud.gateway=debug
spring.cloud.gateway.routes[0].uri=lb://BIZSERVICE-DEMO
spring.cloud.gateway.routes[0].predicates[0]=Path=/demo/**
spring.cloud.gateway.routes[0].filters[0].name=StripPrefix
spring.cloud.gateway.routes[0].filters[0].args.parts=1
spring.cloud.gateway.routes[0].filters[1].name=Hystrix
spring.cloud.gateway.routes[0].filters[1].args.name=fallbackcmd
spring.cloud.gateway.routes[0].filters[1].args.fallbackUri=forward:/fallback
hystrix.command.fallbackcmd.execution.isolation.thread.timeoutInMilliseconds=5000

当我运行网关服务时,请访问http://.../demo/123,the控制台报告:

  

2018-08-02 14:50:49.454 [reactor-http-nio-2]错误ipf.filter.ExceptionHandler-{timestamp = Thu Aug 02 14:50:49 CST 2018,   路径= / demo / demo / 1,状态= 500,错误=内部服务器错误,   message =无法找到名称为Hystrix的GatewayFilterFactory,   trace = java.lang.IllegalArgumentException:无法找到   名称为Hystrix的GatewayFilterFactory         在org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator.lambda $ loadGatewayFilters $ 3(RouteDefinitionRouteLocator.java:142)         在java.util.stream.ReferencePipeline $ 3 $ 1.accept(ReferencePipeline.java:193)         在java.util.ArrayList $ ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)         在java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)         在

这个麻烦困扰我,请帮助我

1 个答案:

答案 0 :(得分:1)

也许,您应该使用此依赖项
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency>

不是这个
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-hystrix</artifactId> </dependency>