How to set custom Feign client connection timeout?

后端 未结 2 1134
离开以前
离开以前 2021-02-03 11:48

I have Spring Boot application with this Gradle dependencies:

compile(\"org.springframework.cloud:spring-cloud-starter-eureka\")
compile(\"org.springframework.cl         


        
2条回答
  •  北荒
    北荒 (楼主)
    2021-02-03 12:44

    You can be configured timeout using configuration properties on application.yaml file:

    feign:
      client:
        config:
          default:
            connectTimeout: 5000
            readTimeout: 5000
    

    Notice that this will change your default feign configuration, if you want to update the timeouts just for your client replace default with the name configured in @FeignClient in your case it will be client, another thing is that you must specify both connectTimeout and readTimeout for this to take effect.

    For more detail see this: documentation

提交回复
热议问题