-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Closed
Description
While working on https://github.com/sdeleuze/spring-petclinic-data-jdbc/tree/crac, I figured out that when org.crac:crac:1.4.0
dependency is in the classpath, ClinicServiceTests
fails with the following error:
aused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hikariCheckpointRestoreLifecycle' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Unsatisfied dependency expressed through method 'hikariCheckpointRestoreLifecycle' parameter 0: No qualifying bean of type 'com.zaxxer.hikari.HikariDataSource' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at app//org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:801)
at app//org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:545)
at app//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
at app//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1166)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hikariCheckpointRestoreLifecycle' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Unsatisfied dependency expressed through method 'hikariCheckpointRestoreLifecycle' parameter 0: No qualifying bean of type 'com.zaxxer.hikari.HikariDataSource' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at app//org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:801)
at app//org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:545)
at app//org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
A workaround is to specify @AutoConfigureTestDatabase(replace = Replace.AUTO_CONFIGURED)
but would be nice it works out of the box (I added it to the branch so make sure to remove it to reproduce).
As found by @wilkinsona, it also fails if the data source has been wrapped by a bean post-processor as the type changes.
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug