spring - 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
解决方案
推荐阅读
- kubernetes - Kubernetes 如何帮助降低托管成本?
- typescript - 打字稿:是否可以强制“keyof T”为字符串?
- javascript - 我写了一个秒表代码,但是这段代码没有运行
- python - 有没有办法在本地 Jupyter Notebook 中使用 Google Colab Form 功能?
- php - 如果图像字段为空,我如何让它不显示任何内容
- python - 创建一个数据框,将代码作为行,将 for 循环作为列
- reactjs - React+TS+i18n,如何测试用 react-intl 包裹的组件
- python - 当 len 应用于哨兵对象时,如何使用它们?
- javascript - 有没有办法在 HTML 表格上自定义选取框以减少滚动延迟?
- reactjs - 将功能组件道具传递给 React 中的静态属性