mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-21 20:37:10 +08:00
refactor(core): restClientBuilder 抽取到 common-core 包
This commit is contained in:
parent
5b2684b33d
commit
0200b92178
@ -20,6 +20,7 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.client.RestClient;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
@ -40,4 +41,15 @@ public class RestTemplateConfiguration {
|
||||
return new RestTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* REST 客户端构建器(支持负载均衡)
|
||||
* @return {@link RestClient.Builder }
|
||||
*/
|
||||
@Bean
|
||||
@LoadBalanced
|
||||
@ConditionalOnProperty(value = "spring.cloud.nacos.discovery.enabled", havingValue = "true", matchIfMissing = true)
|
||||
RestClient.Builder restClientBuilder() {
|
||||
return RestClient.builder();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,8 +8,6 @@ import com.pig4cloud.pig.common.excel.provider.RemoteDictDataProvider;
|
||||
import com.pig4cloud.plugin.excel.handler.DictDataProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.client.RestClient;
|
||||
import org.springframework.web.client.support.RestClientAdapter;
|
||||
@ -26,17 +24,6 @@ import java.util.Optional;
|
||||
@AutoConfiguration
|
||||
public class ExcelAutoConfiguration {
|
||||
|
||||
/**
|
||||
* REST 客户端构建器(支持负载均衡)
|
||||
* @return {@link RestClient.Builder }
|
||||
*/
|
||||
@Bean
|
||||
@LoadBalanced
|
||||
@ConditionalOnProperty(value = "spring.cloud.nacos.discovery.enabled", havingValue = "true", matchIfMissing = true)
|
||||
RestClient.Builder restClientBuilder() {
|
||||
return RestClient.builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 远程 dict API 服务
|
||||
* @return {@link RemoteDictApiService }
|
||||
|
Loading…
Reference in New Issue
Block a user