首页 > 解决方案 > Spring RestTemplate 禁用 SSL 证书验证

问题描述

我需要一个 RestTemplate 类示例来禁用不允许我使用 influx 的 SSL 证书。当我尝试从 influx db 运行 getAll 类型的 REST API 方法时,出现以下错误:

("org.influxdb.InfluxDBIOException: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target")

我想知道在哪里插入这个类,然后如何在我的项目中调用它。我为我糟糕的英语道歉。你能帮我吗?这是我的项目的应用程序属性:

### Application server ###
server.port=8088

### DATABASE POSTGRES LOCAL ###
#spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:postgresql://localhost:5xx2/xxxxres
spring.datasource.username=xxxx
spring.datasource.password=xxxx

### INFLUX ###
spring.influx.url=https://xxxxxx.it:66xx3
spring.influx.user=xxxx
spring.influx.password=xxx
spring.influx.database=xxx

标签: springssl-certificateresttemplateinfluxdbdisable

解决方案


推荐阅读