After I add spring-cloud-sleuth-zipkin-stream into pom.xml. The app can start.But i can't invoke my controller

170 views Asked by At

First I want to integrate zipkin + rabbitmq into my project. So my pom.xml is below:

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-sleuth</artifactId>
    </dependency>

So after I add this. I can't not invoke my controller. But if the controller in the same package with the Application, can the controller be invoked?

1

There are 1 answers

2
Marcin Grzejszczak On

It has nothing to do with Spring Cloud Sleuth or Zipkin. @SpringBootApplication automatically does @ComponentScan so all @RestController classes will get registered as beans if they are in the same package as your @SpringBootApplication annotated class or if it's in the child packages. Please read and try to understand how Spring Boot works by reading this chapter of the docs - https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-using-springbootapplication-annotation.html