gpt4 book ai didi

java - Spring-cloud-starter-openfeign : SSL handshake exception with feign-httpclient

转载 作者:行者123 更新时间:2023-12-02 01:46:22 25 4
gpt4 key购买 nike

当尝试将 feign-httpclient 与 Spring-cloud-starter-openfeign 一起使用时,我收到 SSL 握手异常,而如果我不使用,相同的代码可以工作feign-httpclient。

我需要使用 feign-httpclient,因为我想使用连接工厂。

构建.gradle

//on commenting the below dependency the code works fine.
compile('io.github.openfeign:feign-httpclient:9.4.0')
compile('org.springframework.cloud:spring-cloud-starter-openfeign')

假客户端

@FeignClient(name = "testClient", url = "https://test:9820")
public interface TestClient {
@RequestMapping(method = RequestMethod.POST, value = "/test", consumes = "application/json", produces = "application/json")
TesteDto get(TestRequestDto testRequestDto);
}

调用代码:

 testClient.get(new TestRequestDto("test"));

应用程序.yml

feign:
client:
config:
default:
connectTimeout: 5000
readTimeout: 5000
loggerLevel: full
httpclient:
maxConnections: 200
maxConnectionsPerRoute: 200
enabled: true

异常(exception):

javax.net.ssl.SSLHandshakeException: 
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target

最佳答案

需要的是以下配置:

feign:
httpclient:
disableSslValidation: true

关于java - Spring-cloud-starter-openfeign : SSL handshake exception with feign-httpclient,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53645425/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com