Feign Client Error Handling

前端 未结 2 1215
生来不讨喜
生来不讨喜 2021-01-20 04:18

I am using Feign Client,

I have a Location service. So I created a client for my LocationService using FeignClient.

@FeignClient(url=\"http://localho         


        
2条回答
  •  轮回少年
    2021-01-20 05:01

    You can define a fallback client that is called when an exception like timeout or connection refused comes up:

    @FeignClient(url="http://localhost:9003/location/v1", name="location-service", fallback=LocationFallbackClient.class)
    public interface LocationControllerVOneClient {
        ...
    }
    

    LocationFallbackClient must implement LocationControllerVOneClient.

提交回复
热议问题