Skip to content

Commit

Permalink
README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
chentianming11 committed Jun 11, 2022
1 parent c726a3a commit bcbf77c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ public class TestService {

```yaml
retrofit:
# 全局转换器工厂(已经内置了组件扩展的转换器工厂,这里请勿重复配置)
# 全局转换器工厂(组件扩展的转换器工厂已经内置,这里请勿重复配置)
global-converter-factories:
- retrofit2.converter.jackson.JacksonConverterFactory
# 全局调用适配器工厂(已经内置了组件扩展的调用适配器工厂,这里请勿重复配置)
# 全局调用适配器工厂(组件扩展的调用适配器工厂已经内置,这里请勿重复配置)
global-call-adapter-factories:

# 全局日志打印配置
Expand Down Expand Up @@ -846,15 +846,12 @@ public interface HttpApi {

**我们也可以通过继承`CallAdapter.Factory`扩展实现自己的`CallAdapter`**

组件支持通过`retrofit.global-call-adapter-factories`
配置全局调用适配器工厂,工厂实例优先从Spring容器获取,如果没有获取到,则反射创建。默认的全局调用适配器工厂是`[BodyCallAdapterFactory, ResponseCallAdapterFactory]`

组件支持通过`retrofit.global-call-adapter-factories`配置全局调用适配器工厂,工厂实例优先从Spring容器获取,如果没有获取到,则反射创建。
```yaml
retrofit:
# 全局调用适配器工厂
# 全局转换器工厂(组件扩展的转换器工厂已经内置,这里请勿重复配置)
global-call-adapter-factories:
- com.github.lianjiatech.retrofit.spring.boot.core.BodyCallAdapterFactory
- com.github.lianjiatech.retrofit.spring.boot.core.ResponseCallAdapterFactory
# ...
```

针对每个Java接口,还可以通过`@RetrofitClient`注解的`callAdapterFactories()`指定当前接口采用的`CallAdapter.Factory`,指定的工厂实例依然优先从Spring容器获取。
Expand All @@ -881,9 +878,8 @@ retrofit:

```yaml
retrofit:
# 全局转换器工厂
# 全局调用适配器工厂(组件扩展的调用适配器工厂已经内置,这里请勿重复配置)
global-converter-factories:
- com.github.lianjiatech.retrofit.spring.boot.core.BasicTypeConverterFactory
- retrofit2.converter.jackson.JacksonConverterFactory
```
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

retrofit:
# 全局转换器工厂(已经内置了组件扩展的转换器工厂,这里请勿重复配置)
# 全局转换器工厂(组件扩展的转换器工厂已经内置,这里请勿重复配置)
global-converter-factories:
- retrofit2.converter.jackson.JacksonConverterFactory
# 全局调用适配器工厂(已经内置了组件扩展的调用适配器工厂,这里请勿重复配置)
# 全局调用适配器工厂(组件扩展的调用适配器工厂已经内置,这里请勿重复配置)
global-call-adapter-factories:

# 全局日志打印配置
Expand Down

0 comments on commit bcbf77c

Please sign in to comment.