gpt4 book ai didi

java - Hikari 抛出错误 Property url does not exist on target class org.postgresql.ds.PPGoolingDataSource

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

我正面临来自 kubernetes 集群的这个错误。虽然它在我的本地服务器上运行得很好。这是我的SpringBoot App的application.yml

Spring :

datasource:
dataSourceClassName: org.postgresql.ds.PGPoolingDataSource
url: jdbc:postgresql://${POSTGRES_HOST}:5432/test_db
databaseName: test_db
poolName: SpringBootHikariCP
username: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}
testWhileIdle: true
validationQuery: SELECT 1
jpa:
database-platform: org.hibernate.dialect.PostgreSQL82Dialect
openInView: false
show_sql: true
generate-ddl: true
hibernate:
ddl-auto: update
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
use-new-id-generator-mappings: true
properties:
hibernate.cache.use_second_levelt_cache: false
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: true
hibernate.hbm2ddl.auto: validate

这是我的 Hikari 配置。

            HikariConfig config = new HikariConfig();
config.setDataSourceClassName(dataSourceClassName);
config.addDataSourceProperty("url", url);
config.addDataSourceProperty("user", user);
config.addDataSourceProperty("password", password);

return new HikariDataSource(config);

我已经在没有 Hikari 的情况下检查了 kubernetes 的数据库连接,它运行良好。所以连接没有问题。请帮我解决这个问题。我坚持了几天。谢谢

最佳答案

${POSTGRES_HOST} 期待一个 system environment variable您可能在特定机器中缺少,例如添加它:

export POSTGRES_HOST="1.1.1.1"

关于java - Hikari 抛出错误 Property url does not exist on target class org.postgresql.ds.PPGoolingDataSource,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52050722/

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