Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

配置多个GlobalConfiguration 时可能产生的问题 #379

Open
hardlove opened this issue Sep 11, 2020 · 0 comments
Open

配置多个GlobalConfiguration 时可能产生的问题 #379

hardlove opened this issue Sep 11, 2020 · 0 comments

Comments

@hardlove
Copy link

配置多个GlobalConfiguration 时,如果
每个都配置
.gsonConfiguration((context1, gsonBuilder) -> {//这里可以自己自定义配置 Gson 的参数
gsonBuilder
.serializeNulls()//支持序列化值为 null 的参数
.enableComplexMapKeySerialization();//支持将序列化 key 为 Object 的 Map, 默认只能序列化 key 为 String 的 Map
})
.retrofitConfiguration((context1, retrofitBuilder) -> {//这里可以自己自定义配置 Retrofit 的参数, 甚至您可以替换框架配置好的 OkHttpClient 对象 (但是不建议这样做, 这样做您将损失框架提供的很多功能)
// retrofitBuilder.addConverterFactory(FastJsonConverterFactory.create());//比如使用 FastJson 替代 Gson
})
则,其他的都会配覆盖掉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant