java.lang.IllegalArgumentException: ExistingValue must be an instance of com.zaxxer.hikari.HikariDataSource error occurs during configuration refresh (e.g. Consul - Spring Cloud Consul Config spring-cloud-starter-consul-config)
The check in the method: org.springframework.boot.context.properties.bind.Bindable#withExistingValue does not pass because as the error says, the given value is not an instance of HikariDataSource.
It's very similar to these historical issues in other libs:
spring-cloud/spring-cloud-sleuth#2096 (but of course, Spring Cloud Sleuth is out)
open-telemetry/opentelemetry-java-instrumentation#13512
I can see in this implementation it is net.ttddyy.dsproxy.proxy.jdk.DataSourceInvocationHandler which then creates JDK proxy by default.
Looks like a bug, but I think I could change the DataSource proxy type to CONCRETE and extend spring.cloud.refresh.never-refreshable config, which should work as a workaround.
Versions
Spring Boot: 3.5.11
Spring Cloud dependencies: 2025.0.1
java.lang.IllegalArgumentException: ExistingValue must be an instance of com.zaxxer.hikari.HikariDataSourceerror occurs during configuration refresh (e.g. Consul - Spring Cloud Consul Configspring-cloud-starter-consul-config)The check in the method:
org.springframework.boot.context.properties.bind.Bindable#withExistingValuedoes not pass because as the error says, the given value is not an instance ofHikariDataSource.It's very similar to these historical issues in other libs:
spring-cloud/spring-cloud-sleuth#2096 (but of course, Spring Cloud Sleuth is out)
open-telemetry/opentelemetry-java-instrumentation#13512
I can see in this implementation it is
net.ttddyy.dsproxy.proxy.jdk.DataSourceInvocationHandlerwhich then creates JDK proxy by default.Looks like a bug, but I think I could change the DataSource proxy type to
CONCRETEand extendspring.cloud.refresh.never-refreshableconfig, which should work as a workaround.Versions
Spring Boot: 3.5.11
Spring Cloud dependencies: 2025.0.1