Merge pull request #308 from wehotel/develop
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
<spring-session-bom.version>Dragonfruit-SR3</spring-session-bom.version>
|
||||
<reactor-bom.version>Dysprosium-SR22</reactor-bom.version>
|
||||
<lettuce.version>5.3.7.RELEASE</lettuce.version>
|
||||
<netty.version>4.1.67.Final</netty.version>
|
||||
<netty.version>4.1.68.Final</netty.version>
|
||||
<httpcore.version>4.4.14</httpcore.version>
|
||||
<log4j2.version>2.14.1</log4j2.version>
|
||||
<slf4j.version>1.7.32</slf4j.version>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package we;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2020 the original author or authors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package we.config;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.function.client.ClientHttpConnectorAutoConfiguration;
|
||||
import org.springframework.boot.web.reactive.function.client.WebClientCustomizer;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
/**
|
||||
* @author hongqiaowei
|
||||
*/
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(WebClient.class)
|
||||
@AutoConfigureAfter({CodecsAutoConfiguration.class, ClientHttpConnectorAutoConfiguration.class})
|
||||
public class WebClientBuilderConfig {
|
||||
|
||||
private final WebClient.Builder webClientBuilder;
|
||||
|
||||
public WebClientBuilderConfig(ObjectProvider<WebClientCustomizer> customizerProvider) {
|
||||
this.webClientBuilder = WebClient.builder();
|
||||
customizerProvider.orderedStream().forEach(
|
||||
(customizer) -> {
|
||||
customizer.customize(this.webClientBuilder);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public WebClient.Builder getBuilder() {
|
||||
return this.webClientBuilder.clone();
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,6 @@ import reactor.netty.tcp.TcpClient;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.net.ssl.SSLException;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@@ -127,8 +126,11 @@ public abstract class WebClientConfig {
|
||||
// @Resource
|
||||
// ReactorClientHttpConnector reactorClientHttpConnector;
|
||||
|
||||
// @Resource
|
||||
// WebClient.Builder webClientBuilder;
|
||||
|
||||
@Resource
|
||||
WebClient.Builder webClientBuilder;
|
||||
WebClientBuilderConfig webClientBuilderConfig;
|
||||
|
||||
public WebClient webClient() {
|
||||
|
||||
@@ -175,7 +177,8 @@ public abstract class WebClientConfig {
|
||||
}
|
||||
}
|
||||
|
||||
return webClientBuilder.exchangeStrategies(
|
||||
return webClientBuilderConfig.getBuilder()
|
||||
.exchangeStrategies(
|
||||
ExchangeStrategies.builder().codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(-1))
|
||||
.build()
|
||||
)
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -10,7 +10,7 @@
|
||||
<reactor-bom.version>Dysprosium-SR22</reactor-bom.version>
|
||||
<lettuce.version>5.3.7.RELEASE</lettuce.version>
|
||||
<nacos.cloud.version>2.2.5.RELEASE</nacos.cloud.version>
|
||||
<netty.version>4.1.67.Final</netty.version>
|
||||
<netty.version>4.1.68.Final</netty.version>
|
||||
<httpcore.version>4.4.14</httpcore.version>
|
||||
<log4j2.version>2.14.1</log4j2.version>
|
||||
<slf4j.version>1.7.32</slf4j.version>
|
||||
|
||||
Reference in New Issue
Block a user