简体   繁体   中英

Spring Cloud Gateway 2.0.0.RELEASE:Unable to find GatewayFilterFactory with name 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

When I run gateway service,visit http://.../demo/123,the console reports:

2018-08-02 14:50:49.454 [reactor-http-nio-2] ERROR ipf.filter.ExceptionHandler - {timestamp=Thu Aug 02 14:50:49 CST 2018, path=/demo/demo/1, status=500, error=Internal Server Error, message=Unable to find GatewayFilterFactory with name Hystrix, trace=java.lang.IllegalArgumentException: Unable to find GatewayFilterFactory with name Hystrix at org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator.lambda$loadGatewayFilters$3(RouteDefinitionRouteLocator.java:142) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at

What is the cause of it, and what can I do to prevent it?

Maybe,you should use this dependency
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency>

not this one
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-hystrix</artifactId> </dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM