Comments (8)
作者在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.
作者在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.
作者在自述中都写了。
在标注@RetrofitClient注解的那个接口中添加如下:
@OkHttpClientBuilder
静态OkHttpClient.Builder okhttpClientBuilder(){
返回新OkHttpClient.Builder()
.connectTimeout(60 TimeUnit.SECONDS)
.readTimeout(60 ,TimeUnit.SECONDS)
.writeTimeout(60,TimeUnit.SECONDS);
}
你可能没看清楚我用的版本,我用的版本没有这个注解
from retrofit-spring-boot-starter.
作者在自述中都写了。
在标注@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.
给我提供的接口太垃圾了,要18秒才能请求完数据,我说用队列同步数据就是了,这些人死活不用,非要直接请求接口同步数据
from retrofit-spring-boot-starter.
问题补充,我这里目前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.
问题补充,我这里目前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.
问题补充,我这里目前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)
- retrofit能和openfeign一起在一个项目中使用,全局熔断策略不生效 HOT 11
- @FieldMap和@QueryMap只支持Map参数 HOT 2
- 数据转码有bug HOT 1
- springboot + retrofit 如何自定义时间格式 HOT 1
- 拦截器中无法使用@Autowired注入属性 HOT 2
- 自定义OkHttpClient中的属性,需要每个@RetrofitClient.sourceOkHttpClient指定当前接口要使用的OkHttpClient HOT 2
- 能否在@RetrofitClient上指定Bean Name HOT 2
- 使用@RetrofitClient注册的组件似乎不能在单元测试中正确加载 HOT 1
- retry是否能够增加日志 HOT 2
- @Retry能否支持自定义handler方式,类似于@Intercept(handler = CustoomInterceptor.class) HOT 2
- ServiceInstanceChooser 实现类无法注入 LoadBalancerClient HOT 3
- LoggingInterceptor无法继承,会报globalLogProperty无法autowired HOT 1
- 能否支持 `okhttp3.logging.HttpLoggingInterceptor#redactHeader` HOT 1
- 是否支持springboot3.1.x ? HOT 1
- 拦截器兼容性不行 HOT 2
- 文档太老了,能否根据2.x,3.x 更新一下使用文档 HOT 1
- 2.2.14 版本, FallbackFactory 不生效. HOT 6
- A component required a bean of type 'com.github.lianjiatech.retrofit.spring.boot.config.RetrofitConfigBean' that could not be found. HOT 2
- 升级 retrofit 2.11.0
- 这个可以配置响应拦截器吗?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from retrofit-spring-boot-starter.