天天看點

Hystrix fallback method wasn‘t found

錯誤是由于目标方法和回退方法 參數 和 傳回類型 要一緻

@HystrixCommand(fallbackMethod = "timeOutHandle", commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "3000")
    })
    @Override
    public BaseResult getPaymentOrderById(Integer id) {
        int timeOutSeconds = 5;
        try {
            TimeUnit.SECONDS.sleep(timeOutSeconds);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        return BaseResult.success(serverPort);
    }

    public BaseResult timeOutHandle(Integer id) {
        return BaseResult.error(serverPort);
    }