Configuration of spring.datasource.hikari.* properties in Finchley.M5 causes Spring Boot 2.0.0.RC1 application to fail

See original GitHub issue

Originally posted at https://github.com/spring-projects/spring-boot/issues/11901, but problem appears to lie with spring-cloud-commons, so re-posting here.


Hi,

I see this problem in 2.0.0.RC1 but not in 2.0.0.M7. My application contains several spring.datasource.hikari.* properties. (maximum-pool-size or schema are examples that cause this problem)

This causes the application to fail to start with the exception:

Caused by: java.lang.IllegalStateException: The configuration of the pool is sealed once started. Use HikariConfigMXBean for runtime changes.

It seems to be that the Datasource is configured on the initial refresh, and then again when this fires in ConfigurationPropertiesRebinder:

@Override
public void onApplicationEvent(EnvironmentChangeEvent event) {
	rebind();
}

HikariCP V2.7.6 seals the configuration preventing properties from being changed. It seems the above application event tries to ‘reconfigure’ the sealed datasource and throws the above exception, causing the application to fail to start.

The newer HikariCP dependency is introduced via spring-boot-starter-jdbc 2.0.0.RC1. The 2.0.0.M7 version pulls in HikariCP 2.7.4 which (on first glance) doesn’t appear to seal the configuration in this way.

I can work around the issue for now by ensuring Hikari 2.7.4 appears first on the class path.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kerwin612commented, Jul 25, 2018

@dsyer hi,checkout https://github.com/ileler/java/tree/hikari-exception/hikari-exception view my code,
No problem at startup, the problem occurs when I refresh the configuration.
After startup, execute curl -v -X POST localhost:11001/actuator/refresh on the command line.
I tracked your code and found that adding the following configuration will handle this problem.

spring:
  cloud:
    refresh.extra-refreshable:
      - javax.sql.DataSource

I have already dealt with the problem, but I still think this should be added to the default configuration, so I have a PR.

0reactions
dsyercommented, Jul 24, 2018

Mybatis is probably not something anyone tested. Please provide a link to a project that reproduces the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

spring-cloud/spring-cloud - Gitter
Hey, I have a (test) project with Spring Cloud Config Server and Client (4.0.0-M5). If both server and client have a spring.jackson.property-naming-strategy set ......
Read more >
springboot2 升级后启动不起来 - CSDN
4、SpringBoot启动报错:Failed to introspect Class [org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration] from ClassLoader ...
Read more >
glove_vocab.250k.txt - Bar Ilan NLP Lab
... saturday cannot wo terms pages bill land e fine cause designed resources ... ii weekend direct built focus spring glass career floor...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found