Use String instead of Protocol to avoid AOT processing issues.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLContext;
|
||||
@@ -261,7 +262,8 @@ public class FeignAutoConfiguration {
|
||||
int connectTimeout = httpClientProperties.getConnectionTimeout();
|
||||
boolean disableSslValidation = httpClientProperties.isDisableSslValidation();
|
||||
Duration readTimeout = httpClientProperties.getOkHttp().getReadTimeout();
|
||||
List<Protocol> protocols = httpClientProperties.getOkHttp().getProtocols();
|
||||
List<Protocol> protocols = httpClientProperties.getOkHttp().getProtocols().stream().map(Protocol::valueOf)
|
||||
.collect(Collectors.toList());
|
||||
if (disableSslValidation) {
|
||||
disableSsl(builder);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
* Copyright 2013-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -340,8 +340,9 @@ public class FeignHttpClientProperties {
|
||||
|
||||
/**
|
||||
* Configure the protocols used by this client to communicate with remote servers.
|
||||
* Uses {@link String} values of {@link Protocol}.
|
||||
*/
|
||||
private List<Protocol> protocols = List.of(Protocol.HTTP_2, Protocol.HTTP_1_1);
|
||||
private List<String> protocols = List.of("HTTP_2", "HTTP_1_1");
|
||||
|
||||
public Duration getReadTimeout() {
|
||||
return readTimeout;
|
||||
@@ -351,11 +352,11 @@ public class FeignHttpClientProperties {
|
||||
this.readTimeout = readTimeout;
|
||||
}
|
||||
|
||||
public List<Protocol> getProtocols() {
|
||||
public List<String> getProtocols() {
|
||||
return protocols;
|
||||
}
|
||||
|
||||
public void setProtocols(List<Protocol> protocols) {
|
||||
public void setProtocols(List<String> protocols) {
|
||||
this.protocols = protocols;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,13 +40,13 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author changjin wei(魏昌进)
|
||||
*/
|
||||
@SpringBootTest(classes = FeignOkProtocolsTests.Application.class, webEnvironment = WebEnvironment.RANDOM_PORT,
|
||||
@SpringBootTest(classes = FeignOkHttpProtocolsTests.Application.class, webEnvironment = WebEnvironment.RANDOM_PORT,
|
||||
value = { "spring.application.name=feignclienttest", "spring.cloud.openfeign.circuitbreaker.enabled=false",
|
||||
"spring.cloud.openfeign.httpclient.hc5.enabled=false", "spring.cloud.openfeign.okhttp.enabled=true",
|
||||
"spring.cloud.httpclientfactories.ok.enabled=true", "spring.cloud.loadbalancer.retry.enabled=false",
|
||||
"server.http2.enabled=true", "spring.cloud.openfeign.httpclient.okhttp.protocols=H2_PRIOR_KNOWLEDGE" })
|
||||
@DirtiesContext
|
||||
class FeignOkProtocolsTests {
|
||||
class FeignOkHttpProtocolsTests {
|
||||
|
||||
@Autowired
|
||||
private Client feignClient;
|
||||
Reference in New Issue
Block a user