【发布时间】:2022-08-24 19:58:54
【问题描述】:
应用程序无法启动
描述:
绑定到目标 HikariDataSource (HikariPool-1) 失败:
Property: spring.datasource.hikari.connectionTestQuery
Value: SELECT 1
Reason: Property \'connectionTestQuery\' threw exception; nested exception is java.lang.IllegalStateException: The configuration of the pool is sealed once started. Use HikariConfigMXBean for runtime changes.
-
请在此处分享 hikari bean 定义。
-
@AshishPatil我没有为hikari创建bean,我在spring boot中指定了hikari属性,如下所示spring.datasource.driver-class-name=net.sourceforge.jtds.jdbc.Driver spring.datasource.hikari.connection- test-query=SELECT 1 spring.datasource.hikari.data-source-properties.socketTimeout=300 spring.datasource.hikari.data-source-properties.loginTimeout=20 spring.datasource.hikari.minimumIdle=1 spring.datasource.hikari .maximumPoolSize=1 spring.datasource.hikari.idleTimeout=600000 spring.datasource.hikari.maxLifetime=18000 spring.datasource.hikari.connectionTimeout=3000
-
bean定义不一定意味着java bean。因此,在您的应用程序属性中,您有
spring.datasource.hikari.connection-test-query=SELECT 1这不是必需的,这就是我在回答中提到的。从属性中删除此条目,如果它有效,您可以通过接受答案来关闭问题。 -
将 spring boot 版本迁移到以下 <parent> <groupId>com.accurate.boot</groupId> <artifactId>accurate-spring-starter-parent</artifactId> <version>1.5.22.RELEASE</version> < /父>
标签: java spring spring-boot hikaricp