Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
方法参数不匹配的Spring Hystrix单一回退_Spring_Rest_Spring Boot_Hystrix_Circuit Breaker - Fatal编程技术网

方法参数不匹配的Spring Hystrix单一回退

方法参数不匹配的Spring Hystrix单一回退,spring,rest,spring-boot,hystrix,circuit-breaker,Spring,Rest,Spring Boot,Hystrix,Circuit Breaker,我想知道是否可以实现如下内容,因为我有很多端点变体,并且每个端点都有一个带有匹配参数的回退方法非常混乱。或者,全球撤退也可以 @RestController @RequestMapping(value = "/rest") class SomeRestController { @RequestMapping(value = "/test2", method = { RequestMethod.GET}) @HystrixCommand(fallbackMethod = "fall

我想知道是否可以实现如下内容,因为我有很多端点变体,并且每个端点都有一个带有匹配参数的回退方法非常混乱。或者,全球撤退也可以

@RestController
@RequestMapping(value = "/rest")
class SomeRestController {


   @RequestMapping(value = "/test2", method = { RequestMethod.GET})
   @HystrixCommand(fallbackMethod = "fallback") // FIXME Will error here because arguments do not match
   public String test2(@RequestBody String body) {
    return "Test2";
   }

   @RequestMapping(value = "/test", method = { RequestMethod.GET})
   @HystrixCommand(fallbackMethod = "fallback")
   public String test() {
    return "Test";
   }

   public String fallback() {
    return "generic fallback"; // Return 503 and a message
   }

}

Hystrix提供默认方法支持

您可以按以下方式使用它-
@HystrixCommand(defaultFallback=“fallback”)

Hystrix提供默认方法支持

您可以按以下方式使用它- @HystrixCommand(defaultFallback=“fallback”)