-
Notifications
You must be signed in to change notification settings - Fork 781
Closed
Labels
Milestone
Description
Bug report
If I use starter-webflux with actuator and starter-zipkin, and if I use rest template builder bean, then I receive a circular dependency amongst beans in the app context.
My pom file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>gs-spring-boot</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
The cycle:
Description:
The dependencies of some of the beans in the application context form a cycle:
┌─────┐
| someService defined in file [/Users/bgvozdev/src/test/cycle/target/classes/hello/SomeService.class]
↑ ↓
| restTemplateBuilder defined in class path resource [org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfiguration.class]
↑ ↓
| org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientAutoConfiguration$RestTemplateConfig$TraceInterceptorConfiguration (field private brave.spring.web.TracingClientHttpRequestInterceptor org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientAutoConfiguration$RestTemplateConfig$TraceInterceptorConfiguration.clientInterceptor)
↑ ↓
| tracingClientHttpRequestInterceptor defined in class path resource [org/springframework/cloud/sleuth/instrument/web/client/TraceWebClientAutoConfiguration$RestTemplateConfig.class]
↑ ↓
| httpTracing defined in class path resource [org/springframework/cloud/sleuth/instrument/web/TraceHttpAutoConfiguration.class]
↑ ↓
| org.springframework.boot.actuate.autoconfigure.health.HealthEndpointWebExtensionConfiguration$ReactiveWebHealthConfiguration
↑ ↓
| reactiveHealthIndicatorRegistry defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfiguration$ReactiveHealthIndicatorConfiguration.class]
↑ ↓
| troublesomeComponent defined in file [/Users/bgvozdev/src/test/cycle/target/classes/hello/TroublesomeComponent.class]
└─────┘
The sample app: https://github.com/bgvozdev/sleuth-circular-dependency
Steps to reproduce: clone the sample app and run mvn spring-boot:run
In the app there is a HealthIndicator that uses a Component that has a dependency on RestTemplateBuilder.
Reactions are currently unavailable