@ConditionalOnClass(value={okhttp3.ConnectionPool.class,org.springframework.web.client.RestTemplate.class})
@EnableConfigurationProperties(value=OkHttp3ConnectionPoolProperties.class)
@ConditionalOnProperty(prefix="myoss-cloud.ok-http3.connection-pool",
value="enabled",
matchIfMissing=false)
@ConditionalOnWebApplication
@Configuration
public class RestTemplate4OkHttp3ClientAutoConfiguration
extends Object
需要在项目中的 application.yml 中添加下面的属性启用此配置
myoss-cloud.ok-http3.connection-pool.enabled = false
OkHttp3ConnectionPoolProperties| Constructor and Description |
|---|
RestTemplate4OkHttp3ClientAutoConfiguration(OkHttp3ConnectionPoolProperties properties)
初始化 OkHttp3连接池属性配置
|
| Modifier and Type | Method and Description |
|---|---|
org.springframework.web.client.RestTemplate |
restTemplate4OkHttp3(com.alibaba.fastjson.support.config.FastJsonConfig defaultFastJsonConfig,
okhttp3.ConnectionPool restTemplate4OkHttp3ConnectionPool,
List<okhttp3.Interceptor> restTemplate4OkHttp3Interceptor,
List<okhttp3.Interceptor> restTemplate4OkHttp3NetworkInterceptor)
创建OkHttp3 RestTemplate,使用HTTP连接池
|
okhttp3.ConnectionPool |
restTemplate4OkHttp3ConnectionPool()
HTTP连接池管理器,用于
restTemplate4OkHttp3(com.alibaba.fastjson.support.config.FastJsonConfig, okhttp3.ConnectionPool, java.util.List<okhttp3.Interceptor>, java.util.List<okhttp3.Interceptor>),使用 spring 管理,方便项目中替换此对象或者获取此对象 |
List<okhttp3.Interceptor> |
restTemplate4OkHttp3Interceptor()
|
List<okhttp3.Interceptor> |
restTemplate4OkHttp3NetworkInterceptor()
|
public RestTemplate4OkHttp3ClientAutoConfiguration(OkHttp3ConnectionPoolProperties properties)
properties - OkHttp3连接池属性配置@ConditionalOnMissingBean(name="restTemplate4OkHttp3ConnectionPool") @Bean(name="restTemplate4OkHttp3ConnectionPool") public okhttp3.ConnectionPool restTemplate4OkHttp3ConnectionPool()
restTemplate4OkHttp3(com.alibaba.fastjson.support.config.FastJsonConfig, okhttp3.ConnectionPool, java.util.List<okhttp3.Interceptor>, java.util.List<okhttp3.Interceptor>),使用 spring 管理,方便项目中替换此对象或者获取此对象@ConditionalOnMissingBean(name="restTemplate4OkHttp3Interceptor") @Bean(name="restTemplate4OkHttp3Interceptor") public List<okhttp3.Interceptor> restTemplate4OkHttp3Interceptor()
restTemplate4OkHttp3(com.alibaba.fastjson.support.config.FastJsonConfig, okhttp3.ConnectionPool, java.util.List<okhttp3.Interceptor>, java.util.List<okhttp3.Interceptor>),使用 spring 管理,方便项目中替换此对象或者获取此对象@ConditionalOnMissingBean(name="restTemplate4OkHttp3NetworkInterceptor") @Bean(name="restTemplate4OkHttp3NetworkInterceptor") public List<okhttp3.Interceptor> restTemplate4OkHttp3NetworkInterceptor()
restTemplate4OkHttp3(com.alibaba.fastjson.support.config.FastJsonConfig, okhttp3.ConnectionPool, java.util.List<okhttp3.Interceptor>, java.util.List<okhttp3.Interceptor>),使用 spring 管理,方便项目中替换此对象或者获取此对象@ConditionalOnMissingBean(name="restTemplate4OkHttp3")
@Bean(name="restTemplate4OkHttp3")
public org.springframework.web.client.RestTemplate restTemplate4OkHttp3(com.alibaba.fastjson.support.config.FastJsonConfig defaultFastJsonConfig,
okhttp3.ConnectionPool restTemplate4OkHttp3ConnectionPool,
List<okhttp3.Interceptor> restTemplate4OkHttp3Interceptor,
List<okhttp3.Interceptor> restTemplate4OkHttp3NetworkInterceptor)
defaultFastJsonConfig - 参考:
FastJsonAutoConfiguration.defaultFastJsonConfig()restTemplate4OkHttp3ConnectionPool - 参考:
restTemplate4OkHttp3ConnectionPool()restTemplate4OkHttp3Interceptor - 参考:
restTemplate4OkHttp3Interceptor()restTemplate4OkHttp3NetworkInterceptor - 参考:
restTemplate4OkHttp3NetworkInterceptor()Copyright © 2018. All rights reserved.