Giter Site home page Giter Site logo

Comments (8)

Zbuter avatar Zbuter commented on May 21, 2024

作者在readme中都写了。
在 标注@RetrofitClient注解的那个接口 中添加如下:
@OkHttpClientBuilder
static OkHttpClient.Builder okhttpClientBuilder() {
return new OkHttpClient.Builder()
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS);
}

from retrofit-spring-boot-starter.

chentianming11 avatar chentianming11 commented on May 21, 2024

作者在readme中都写了。
在 标注@RetrofitClient注解的那个接口 中添加如下:
@OkHttpClientBuilder
static OkHttpClient.Builder okhttpClientBuilder() {
return new OkHttpClient.Builder()
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.writeTimeout(60, TimeUnit.SECONDS);
}

如果只是配置超时时间,设置@RetrofitClient的相关属性就可以了

from retrofit-spring-boot-starter.

fulintang avatar fulintang commented on May 21, 2024

作者在自述中都写了。
在标注@RetrofitClient注解的那个接口中添加如下:
@OkHttpClientBuilder
静态OkHttpClient.Builder okhttpClientBuilder(){
返回新OkHttpClient.Builder()
.connectTimeout(60 TimeUnit.SECONDS)
.readTimeout(60 ,TimeUnit.SECONDS)
.writeTimeout(60,TimeUnit.SECONDS);
}

你可能没看清楚我用的版本,我用的版本没有这个注解

from retrofit-spring-boot-starter.

fulintang avatar fulintang commented on May 21, 2024

作者在自述中都写了。
在标注@RetrofitClient注解的那个接口中添加如下:
@OkHttpClientBuilder
静态OkHttpClient.Builder okhttpClientBuilder(){
返回新OkHttpClient.Builder()
.connectTimeout(60 TimeUnit.SECONDS)
.readTimeout(60 ,TimeUnit.SECONDS)
.writeTimeout(60,TimeUnit.SECONDS);
}

如果只是配置超时时间,设置@RetrofitClient的相关属​​性就可以了

请问在2.0.2这个版本该怎么设置超时时间呢,我尝试了给okhttp设置超时时间但是并没有用

from retrofit-spring-boot-starter.

fulintang avatar fulintang commented on May 21, 2024

给我提供的接口太垃圾了,要18秒才能请求完数据,我说用队列同步数据就是了,这些人死活不用,非要直接请求接口同步数据

from retrofit-spring-boot-starter.

fulintang avatar fulintang commented on May 21, 2024

问题补充,我这里目前springboot使用2.1.3.RELEASE,retrofit-spring-boot-starter 2.0.2,项目组要求不能换boot版本,我尝试了其他retrofit-spring-boot-starter版本但是启动项目会报错,而目前使用的retrofit-spring-boot-starter 2.0.2没有@OkHttpClientBuilder这个注解

from retrofit-spring-boot-starter.

chentianming11 avatar chentianming11 commented on May 21, 2024

问题补充,我这里目前springboot使用2.1.3.RELEASE,retrofit-spring-boot-starter 2.0.2,项目组要求不能换boot版本,我尝试了其他retrofit-spring-boot-starter版本但是启动项目会报错,而目前使用的retrofit-spring-boot-starter 2.0.2没有@OkHttpClientBuilder这个注解

2.0.2 @RetrofitClient 注解可以设置超时时间。

from retrofit-spring-boot-starter.

fulintang avatar fulintang commented on May 21, 2024

问题补充,我这里目前springboot使用2.1.3版本,retrofit-spring-boot-starter 2.0.2,项目组要求不能换启动版本,我尝试了其他retrofit-spring-boot-starter版本但是启动项目会报错,而目前使用的retrofit-spring-boot-starter 2.0.2没有@OkHttpClientBuilder这个注解

2.0.2 @RetrofitClient 注解可以设置超时时间。

谢谢,非常感谢,看了一下有个readTimeoutMs属性,设置后就好使了!

from retrofit-spring-boot-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.