Skip to content

Commit 219e137

Browse files
Http client zipkin order change
without this change we're registering WebClient sender only for webflux applications and we fallback to a RestTemplate sender in all the other cases with this change we're always trying to register a WebClient sender and fallback to RestTemplate only when WebClient is not on the classpath
1 parent b325edb commit 219e137

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/tracing/zipkin/ZipkinConfigurations.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
class ZipkinConfigurations {
4747

4848
@Configuration(proxyBeanMethods = false)
49-
@Import({ UrlConnectionSenderConfiguration.class, RestTemplateSenderConfiguration.class,
50-
WebClientSenderConfiguration.class })
49+
@Import({ UrlConnectionSenderConfiguration.class, WebClientSenderConfiguration.class,
50+
RestTemplateSenderConfiguration.class })
5151
static class SenderConfiguration {
5252

5353
}
@@ -85,7 +85,7 @@ ZipkinRestTemplateSender restTemplateSender(ZipkinProperties properties,
8585
}
8686

8787
@Configuration(proxyBeanMethods = false)
88-
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
88+
@ConditionalOnClass(WebClient.class)
8989
@EnableConfigurationProperties(ZipkinProperties.class)
9090
static class WebClientSenderConfiguration {
9191

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/tracing/zipkin/ZipkinConfigurationsSenderConfigurationTests.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ void shouldNotUseWebClientSenderIfNoBuilderIsAvailable() {
7777
@Test
7878
void shouldUseRestTemplateSenderIfUrlConnectionSenderIsNotAvailableAndWebAppIsNotReactive() {
7979
this.contextRunner.withUserConfiguration(RestTemplateConfiguration.class)
80-
.withClassLoader(new FilteredClassLoader("zipkin2.reporter.urlconnection")).run((context) -> {
80+
.withClassLoader(
81+
new FilteredClassLoader("zipkin2.reporter.urlconnection", "org.springframework.web.reactive"))
82+
.run((context) -> {
8183
assertThat(context).doesNotHaveBean(URLConnectionSender.class);
8284
assertThat(context).hasSingleBean(Sender.class);
8385
assertThat(context).hasSingleBean(ZipkinRestTemplateSender.class);

0 commit comments

Comments
 (0)