All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.lianjiatech.retrofit.spring.boot.config.RetrofitProperties Maven / Gradle / Ivy

There is a newer version: 3.1.3
Show newest version
package com.github.lianjiatech.retrofit.spring.boot.config;

import com.github.lianjiatech.retrofit.spring.boot.core.BasicTypeConverterFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

import com.github.lianjiatech.retrofit.spring.boot.core.Constants;
import com.github.lianjiatech.retrofit.spring.boot.degrade.DegradeProperty;
import com.github.lianjiatech.retrofit.spring.boot.log.GlobalLogProperty;
import com.github.lianjiatech.retrofit.spring.boot.retry.GlobalRetryProperty;

import lombok.Data;
import retrofit2.CallAdapter;
import retrofit2.Converter;
import retrofit2.converter.jackson.JacksonConverterFactory;

/**
 * @author 陈添明
 */
@ConfigurationProperties(prefix = Constants.RETROFIT)
@Data
public class RetrofitProperties {

    /**
     * 自动设置PathMathInterceptor的scope为prototype
     */
    private boolean autoSetPrototypeScopeForPathMathInterceptor = true;

    /**
     * 全局重试配置
     * 

* retry config */ @NestedConfigurationProperty private GlobalRetryProperty globalRetry = new GlobalRetryProperty(); /** * 熔断降级配置 *

* degrade config */ @NestedConfigurationProperty private DegradeProperty degrade = new DegradeProperty(); /** * 全局日志配置 *

* log config */ @NestedConfigurationProperty private GlobalLogProperty globalLog = new GlobalLogProperty(); /** * 全局超时配置 */ @NestedConfigurationProperty private GlobalTimeoutProperty globalTimeout = new GlobalTimeoutProperty(); /** * 全局转换器工厂,转换器实例优先从Spring容器获取,如果没有获取到,则反射创建。 *

* global converter factories, The converter instance is first obtained from the Spring container. If it is not obtained, it is created by reflection. */ @SuppressWarnings("unchecked") private Class[] globalConverterFactories = (Class[])new Class[] {BasicTypeConverterFactory.class, JacksonConverterFactory.class}; /** * 全局调用适配器工厂,适配器实例优先从Spring容器获取,如果没有获取到,则反射创建。 *

* global call adapter factories, The callAdapter instance is first obtained from the Spring container. If it is not obtained, it is created by reflection. */ @SuppressWarnings("unchecked") private Class[] globalCallAdapterFactories = new Class[0]; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy