0

I have autowired org.springframework.cloud.sleuth.Tracer in a service but getting the following error while building the project (mvn clean install). Although The applications runs through IDE and code works perfectly, but I need a way to remove the error while compiling the project.

Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.cloud.sleuth.Tracer' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

*************************** APPLICATION FAILED TO START ***************************

Description:

Parameter 3 of constructor in com.mmt.corporate.payments.PaymentService required a bean of type 'org.springframework.cloud.sleuth.Tracer' that could not be found.

Action:

Consider defining a bean of type 'org.springframework.cloud.sleuth.Tracer' in your configuration.

have included org.springframework.cloud.sleuth this way in pom.xml :

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-sleuth</artifactId>
    </dependency>
Shreya Sharma
  • 175
  • 1
  • 2
  • 12
  • 1
    It looks like you are trying to inject `Tracer` through parameterized constructor of `PaymentService`. You may not be _autowiring_ it. Can you please add your implementation of `PaymentService`? – Kavitha Karunakaran Jul 14 '20 at 09:22
  • I've tried both. Yes this error stack is of constructor autowiring. – Shreya Sharma Jul 14 '20 at 09:40

1 Answers1

2

The Sleuth's Tracer was present in version 1.3.x. Starting from version 2.x there's no more Tracer from Sleuth. There's one from Brave. Can you please upgrade to the latest version?

Marcin Grzejszczak
  • 10,624
  • 1
  • 16
  • 32