属性文件
server:
port: 8999
eureka:
instance:
hostname: localhost
#Actuator Configuration
management:
endpoints:
web:
exposure:
include: hystrix.stream, health, info
#Hystrix Configuration
hystrix:
command:
fallbackcmd:
execution:
isolation:
thread:
timeoutInMilliseconds: 4000
spring:
application:
name: gateway
cloud:
gateway:
routes:
- id: capability-deck
uri: lb://capability-deck
predicates:
- Path=/capability/**
filters:
- name: CircuitBreaker
args:
name: capability-deck
fallbackuri: forward:/capabilityServiceFallBack
- id: home-page
uri: lb://home-page
predicates:
- Path=/home/**
- id: subscription
uri: lb://subscription
predicates:
- Path=/subscription/**
Run Code Online (Sandbox Code Playgroud)
控制器
package com.valuepedia.gateway.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class FallBackController { …Run Code Online (Sandbox Code Playgroud)