Skip to content

existingValue must be an instance of com.zaxxer.hikari.HikariDataSource #99

@raestio

Description

@raestio

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions