@Retention(value=RUNTIME) @Target(value=TYPE) @Documented public @interface RetrofitClient
| 限定符和类型 | 可选元素和说明 |
|---|---|
String |
baseUrl
绝对URL(协议是必需的)。
|
Class<? extends retrofit2.CallAdapter.Factory>[] |
callAdapterFactories
适用于当前接口的调用适配器工厂,优先级比全局调用适配器工厂更高。
|
int |
callTimeoutMs
Sets the default timeout for complete calls.
|
int |
connectTimeoutMs
Sets the default connect timeout for new connections.
|
Class<? extends retrofit2.Converter.Factory>[] |
converterFactories
适用于当前接口的转换器工厂,优先级比全局转换器工厂更高。
|
boolean |
enableLog
针对当前接口是否启用日志打印
Whether to enable log printing for the current interface
|
Class<? extends ErrorDecoder> |
errorDecoder
当前接口采用的错误解码器,当请求发生异常或者收到无效响应结果的时候,将HTTP相关信息解码到异常中,无效响应由业务自己判断。
|
Class<?> |
fallback
Fallback class for the specified retrofit client interface.
|
Class<?> |
fallbackFactory
Define a fallback factory for the specified Feign client interface.
|
boolean |
followRedirects
Configure this client to follow redirects.
|
boolean |
followSslRedirects
Configure this client to allow protocol redirects from HTTPS to HTTP and from HTTP to HTTPS.
|
LogLevel |
logLevel
|
LogStrategy |
logStrategy
日志打印策略,支持的日志打印策略参见
LogStrategy
如果为NULL,则取全局日志打印策略
Log printing strategy, see LogStrategy for supported log printing strategies |
String |
path
Path prefix to be used by all method-level mappings.
|
int |
pingIntervalMs
Sets the interval between HTTP/2 and web socket pings initiated by this client.
|
String |
poolName
connection pool name
|
int |
readTimeoutMs
Sets the default read timeout for new connections.
|
boolean |
retryOnConnectionFailure
Configure this client to retry or not when a connectivity problem is encountered.
|
String |
serviceId
The name of the service.
|
boolean |
validateEagerly
When calling
Retrofit.create(Class) on the resulting Retrofit instance, eagerly validate the
configuration of all methods in the supplied interface. |
int |
writeTimeoutMs
Sets the default write timeout for new connections.
|
public abstract String baseUrl
public abstract String serviceId
public abstract String path
public abstract Class<? extends retrofit2.Converter.Factory>[] converterFactories
public abstract Class<? extends retrofit2.CallAdapter.Factory>[] callAdapterFactories
public abstract Class<?> fallback
public abstract Class<?> fallbackFactory
RetrofitClient.The fallback factory must be a valid spring bean.
bean.public abstract boolean enableLog
public abstract LogStrategy logStrategy
LogStrategy
如果为NULL,则取全局日志打印策略
Log printing strategy, see LogStrategy for supported log printing strategiespublic abstract boolean validateEagerly
Retrofit.create(Class) on the resulting Retrofit instance, eagerly validate the
configuration of all methods in the supplied interface.public abstract Class<? extends ErrorDecoder> errorDecoder
ErrorDecoder,然后配置在这里。
The error decoder used in the current interface will decode HTTP related information into the exception when an exception occurs in the request or an invalid response result is received.
The invalid response is determined by the business itself.
In general, the invalid response corresponding to each service is different, you can customize the corresponding ErrorDecoder, and then configure it here.
public abstract String poolName
public abstract int connectTimeoutMs
public abstract int readTimeoutMs
public abstract int writeTimeoutMs
public abstract int callTimeoutMs
public abstract int pingIntervalMs
public abstract boolean followSslRedirects
Copyright © 2022. All rights reserved.