I'm trying to use the new @JdbcTest annotation in Spring boot 1.5.0.RC1.
My app uses Eureka discovery ie I have
compile('org.springframework.cloud:spring-cloud-starter-eureka')
in my build.gradle and
@EnableDiscoveryClient
on my main Spring Boot class
When I try to use @JdbcTest to test a JdbcTemplate based DAO I get this error:
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method eurekaHealthIndicator in org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration$EurekaHealthIndicatorConfiguration required a bean of type 'com.netflix.discovery.EurekaClient' that could not be found.
Action:
Consider defining a bean of type 'com.netflix.discovery.EurekaClient' in your configuration.
It looks like the auto configuration is loading part of the Eureka configuration when it should only load JDBC related beans.
If I add
@TestPropertySource(properties={"eureka.client.enabled=false"})
to the test the problem goes away, but I think @JdbcTest should be making sure already that only relevant beans are loaded.
Am I missing something or is this a problem with the new @JdbcTest, or maybe Spring Cloud Eureka?