spring cloud 使用hystrix @HystrixCommand 和 @HystrixProperty配置不起效

1.有两个服务,demo-hystrix和demo-biz
2.demo-biz通过feign调用demo-hystrix
3.demo-hystrix sleep 3000 ms
4.使用注解配置demo-biz对应方法

 @HystrixCommand(commandProperties = {
            @HystrixProperty(name = HystrixPropertiesManager.EXECUTION_ISOLATION_THREAD_TIMEOUT_IN_MILLISECONDS, value = "5000"),
            @HystrixProperty(name = HystrixPropertiesManager.EXECUTION_TIMEOUT_ENABLED, value = "true")})
    @Override
    public String timeOut(@RequestBody @Validated Integer id) {
            //调用demo-hystrix服务方法
        return testServerApi.timeOut(id);
    }

5.配置不起作用,熔断依然发生
附:demo-hystrix 中的API

@FeignClient(value = "demo-hystrix",configuration = FeignHasHystrixConfigure.class,
        fallback = TestServiceFallback.class)
public interface TestServerApi {

    @PostMapping("/normal")
    String normal(@RequestBody @Validated Integer id);

    @PostMapping("/timeOut")
    String timeOut(@RequestBody @Validated Integer id);

    @PostMapping("/exception")
    String exception(@RequestBody @Validated Integer id);

    @PostMapping("/exceptionNPL")
    String exceptionNPL(@RequestBody @Validated Integer id);
}

抱歉,开始搞错了熔断发生的位置。注解加在了调用方不起作用是没问题的,应该加在被调用方的方法上。

https://www.lanhusoft.com/Article/711.html