Ricardo Pina Arellano
Ricardo Pina Arellano

Reputation: 61

How to configure Spring Cloud Turbine Stream and Spring Boot Actuator using 2.0.0.M4 version?

I have the following configuration:

@EnableTurbineStream
@EnableDiscoveryClient
@SpringBootApplication
public class SquintTurbineServerApplication {
   public static void main(final String... args) {
       SpringApplication.run(SquintTurbineServerApplication.class, args);
   }
}

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-reactor-netty</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-client</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-eureka</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-turbine-stream</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

When I try to start up my application this error is thrown:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthIndicator]: Factory method 'binderHealthIndicator' threw exception; nested exception is java.lang.NoClassDefFoundError: org/spr ingframework/boot/actuate/health/RabbitHealthIndicator at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:186) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:597) ... 40 more Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/actuate/health/RabbitHealthIndicator at org.springframework.cloud.stream.binder.rabbit.config.RabbitServiceAutoConfiguration$RabbitHealthIndicatorConfiguration.binderHealthIndicator(RabbitServiceAutoConfiguration.java:141) at org.springframework.cloud.stream.binder.rabbit.config.RabbitServiceAutoConfiguration$RabbitHealthIndicatorConfiguration$$EnhancerBySpringCGLIB$$f894963c.CGLIB$binderHealthIndicator$0() at org.springframework.cloud.stream.binder.rabbit.config.RabbitServiceAutoConfiguration$RabbitHealthIndicatorConfiguration$$EnhancerBySpringCGLIB$$f894963c$$FastClassBySpringCGLIB$$2435cd8c.invoke() at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361) at org.springframework.cloud.stream.binder.rabbit.config.RabbitServiceAutoConfiguration$RabbitHealthIndicatorConfiguration$$EnhancerBySpringCGLIB$$f894963c.binderHealthIndicator() at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:155) ... 41 more

I'v tried to disable the property:

management.health.rabbit.enabled = false

But the error is still being thrown. I'v noticed that turbine-stream is looking for the class "org.springframework.boot.actuate.health.RabbitHealthIndicator", but when searched it, these class is now within "org.springframework.boot.actuate.amqp.RabbitHealthIndicator". Could someone help me?

Upvotes: 0

Views: 498

Answers (1)

Vinicius Carvalho
Vinicius Carvalho

Reputation: 4156

The latest boot update to M4 changed the actuator classes, packages and removed some classes from Metrics.

That is still not compatible with Spring Cloud Stream.

The snapshot of 2.0 on SCSt pulls M2 for that reason, it won't be compatible until we get it fixed on master.

Upvotes: 1

Related Questions