Commit 724bed22 by 李鑫

修复Gateway示例中Hystrix熔断设置的问题

parent 1609e01d
......@@ -83,10 +83,10 @@
</dependency>
<!-- 当Spring Coud Gateway用Hystrix做线程隔离的时候,才需要导入下面的包 -->
<!-- <dependency>
<dependency>
<groupId>com.nepxion</groupId>
<artifactId>discovery-plugin-strategy-starter-hystrix</artifactId>
</dependency> -->
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
......
......@@ -11,6 +11,7 @@ package com.nepxion.discovery.plugin.example.gateway;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
......@@ -19,6 +20,7 @@ import com.nepxion.discovery.plugin.strategy.gateway.filter.GatewayStrategyRoute
@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker
public class DiscoveryApplicationGateway {
public static void main(String[] args) {
new SpringApplicationBuilder(DiscoveryApplicationGateway.class).run(args);
......
# Spring cloud config
# Spring cloud config
spring.application.name=discovery-springcloud-example-gateway
server.port=1500
......@@ -21,7 +21,7 @@ spring.cloud.nacos.discovery.metadata.version=1.0
management.server.port=5500
# Spring cloud gateway config
spring.cloud.gateway.discovery.locator.enabled=true
# spring.cloud.gateway.discovery.locator.enabled=true
spring.cloud.gateway.discovery.locator.lowerCaseServiceId=true
spring.cloud.gateway.routes[0].id=discovery-springcloud-example-a
spring.cloud.gateway.routes[0].predicates[0]=Path=/discovery-springcloud-example-a/**
......@@ -31,8 +31,8 @@ spring.cloud.gateway.routes[0].filters[0]=StripPrefix=1
spring.cloud.gateway.routes[0].uri=lb://discovery-springcloud-example-a
# Hystrix配置
spring.cloud.gateway.routes[0].filters[0].name=Hystrix
spring.cloud.gateway.routes[0].filters[0].args.name=default
spring.cloud.gateway.routes[0].filters[0].args.fallbackUri=forward:/fallback
hystrix.command.default.execution.isolation.strategy=thread
spring.cloud.gateway.routes[0].filters[1].name=Hystrix
spring.cloud.gateway.routes[0].filters[1].args.name=default
spring.cloud.gateway.routes[0].filters[1].args.fallbackUri=forward:/fallback
hystrix.command.default.execution.isolation.strategy=THREAD
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=3000
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment