gpt4 book ai didi

java - Intellij 不更新 spring.datasource.url

转载 作者:行者123 更新时间:2023-12-02 03:45:07 26 4
gpt4 key购买 nike

我将我的项目从 sts 迁移到 intellij,但是 intllij 没有使用 application.properties -> spring.datasource.url 更新连接数据库,不起作用

控制台日志:

2019-06-28 15:52:27.593 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig           : MatdmJPAHikariCP - configuration:
2019-06-28 15:52:27.596 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : allowPoolSuspension.............false
2019-06-28 15:52:27.597 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : autoCommit......................true
2019-06-28 15:52:27.597 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : catalog.........................null
2019-06-28 15:52:27.597 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : connectionInitSql...............null
2019-06-28 15:52:27.597 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : connectionTestQuery.............null
2019-06-28 15:52:27.597 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : connectionTimeout...............30000
2019-06-28 15:52:27.597 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : dataSource......................null
2019-06-28 15:52:27.597 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : dataSourceClassName.............null
2019-06-28 15:52:27.597 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : dataSourceJNDI..................null
2019-06-28 15:52:27.599 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : dataSourceProperties............{password=<masked>}
2019-06-28 15:52:27.599 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : driverClassName................."org.postgresql.Driver"
2019-06-28 15:52:27.600 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : healthCheckProperties...........{}
2019-06-28 15:52:27.600 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : healthCheckRegistry.............null
2019-06-28 15:52:27.600 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : idleTimeout.....................30000
2019-06-28 15:52:27.600 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : initializationFailFast..........true
2019-06-28 15:52:27.600 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : isolateInternalQueries..........false
2019-06-28 15:52:27.600 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : jdbc4ConnectionTest.............false
2019-06-28 15:52:27.600 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : jdbcUrl........................."jdbc:postgresql://localhost:5432/meuatendimento"
2019-06-28 15:52:27.601 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : leakDetectionThreshold..........0
2019-06-28 15:52:27.601 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : maxLifetime.....................2000000
2019-06-28 15:52:27.601 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : maximumPoolSize.................20
2019-06-28 15:52:27.601 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : metricRegistry..................null
2019-06-28 15:52:27.601 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : metricsTrackerFactory...........null
2019-06-28 15:52:27.601 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : minimumIdle.....................5
2019-06-28 15:52:27.601 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : password........................<masked>
2019-06-28 15:52:27.601 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : poolName........................"MatdmJPAHikariCP"
2019-06-28 15:52:27.601 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : readOnly........................false
2019-06-28 15:52:27.602 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : registerMbeans..................false
2019-06-28 15:52:27.602 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : scheduledExecutorService........null
2019-06-28 15:52:27.602 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : threadFactory...................null
2019-06-28 15:52:27.602 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : transactionIsolation............null
2019-06-28 15:52:27.602 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : username........................null
2019-06-28 15:52:27.602 DEBUG 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : validationTimeout...............5000
2019-06-28 15:52:27.602 INFO 78161 --- [ost-startStop-1] com.zaxxer.hikari.HikariDataSource : MatdmJPAHikariCP - Started.
2019-06-28 15:52:27.733 INFO 78161 --- [ost-startStop-1] com.zaxxer.hikari.pool.PoolBase : MatdmJPAHikariCP - Driver does not support get/set network timeout for connections. (Método org.postgresql.jdbc.PgConnection.getNetworkTimeout() ainda não foi implementado.)
2019-06-28 15:52:27.997 INFO 78161 --- [ost-startStop-1] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'

但在我的代码中是这样的:

spring.datasource.url=jdbc:postgresql://localhost:5432/newdb
spring.datasource.username=username
spring.datasource.password=pass
spring.datasource.tomcat.max-active=40
spring.datasource.tomcat.max-idle=40
spring.datasource.tomcat.min-idle=40
jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.datasource.driver-class-name=org.postgresql.Driver
org.springframework.boot = spring-boot-starter-jersey

# Hikari will use the above plus the following to setup connection pooling
spring.datasource.hikari.minimumIdle=5
spring.datasource.hikari.maximumPoolSize=20
spring.datasource.hikari.idleTimeout=30000
spring.datasource.hikari.poolName=MatdmJPAHikariCP
spring.datasource.hikari.maxLifetime=2000000
spring.datasource.hikari.connectionTimeout=30000

我清理了 Intellij 的缓存,但它不起作用。

最佳答案

对于 Hikari 连接池,url 属性是 jdbc-url,而不是 url。所以改变一下

spring.datasource.url=jdbc:postgresql://localhost:5432/newdb至

spring.datasource.jdbc-url=jdbc:postgresql://localhost:5432/newdb

有关详细信息和其他可能的解决方案,请参阅:After Spring Boot 2.0 migration: jdbcUrl is required with driverClassName

关于java - Intellij 不更新 spring.datasource.url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56812123/

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