timeoutInMilliseconds

hystrix设置的超时时间不生效


 @GetMapping("/consumer/payment/gettimeout/{id}")
    @HystrixCommand(fallbackMethod = "getTimeOut_",commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds",value = "3000")
            //3秒钟以内走正常业务逻辑,超过调用getTimeOut_方法返回
    })
    public String  getPaymentByIdTimeOut(@PathVariable("id") Long id){
        return paymentFeignService.gettimeout(id);
    }

    public String getTimeOut_(@PathVariable("id") Long id) {

        return "对方支付繁忙,请稍后重试";
    }

网上说道 全局超时时间默认是1秒,自己设置的超过一秒就不生效,修改全局默认超时时间,



```yaml
#超时时间配置,此处全局超时配置时间大于@HystrixProperty配置时间后,@HystrixProperty注解中的超时才生效
hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 10000  #10

但是这里他报错,说解析不了这个配置,怎么办

img

这个只是IDEA的提示,他检测到你项目了没有用这个配置,但实际上在springboot底层包有这个配置,不用管这个提示。