首页 > 解决方案 > 使用 Spring Cloud 连接器和 HikariCP 配置 Postgresql sslrootcert

问题描述

我目前正在尝试使用 Spring Cloud Connectors 在我的 SpringBoot 2.1.1 应用程序上设置一个数据源(Postgresql)(我的应用程序托管在 PCF 上)。我需要配置我的 sslrootcert 的路径(在我们在 PCF 上使用的服务代理提供的 jdbc url 中没有指定)。

我试过这样配置它:

@Bean
public DataSource dataSource() {
    DataSourceConfig dataSourceConfig = new DataSourceConfig(null, new DataSourceConfig.ConnectionConfig("sslrootcert=/home/vcap/app/.postgresql/root.crt"), Collections.singletonMap("sslrootcert", "/home/vcap/app/.postgresql/root.crt"));
    return connectionFactory().dataSource(dataSourceConfig);
}

但我的 sslrootcert 属性总是被忽略并回退到默认值 ~/.postgresql/root.crt

我在文档中找不到任何关于设置这种驱动程序特定属性的方法。

任何形式的帮助将不胜感激。

标签: springspring-bootcloud-foundrypostgresql-9.6spring-cloud-connectors

解决方案


推荐阅读