Fixed the build for Boot 2.6.0 Snapshots
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.autoconfig.instrument.messaging;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -53,31 +52,31 @@ import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
|
||||
@AutoConfigureAfter(BraveAutoConfiguration.class)
|
||||
class TraceWebSocketAutoConfiguration extends AbstractWebSocketMessageBrokerConfigurer {
|
||||
|
||||
@Autowired
|
||||
Tracer tracer;
|
||||
private final Tracer tracer;
|
||||
|
||||
@Autowired
|
||||
Propagator propagator;
|
||||
private final Propagator propagator;
|
||||
|
||||
@Autowired
|
||||
Propagator.Setter<MessageHeaderAccessor> setter;
|
||||
private final Propagator.Setter<MessageHeaderAccessor> setter;
|
||||
|
||||
@Autowired
|
||||
Propagator.Getter<MessageHeaderAccessor> getter;
|
||||
private final Propagator.Getter<MessageHeaderAccessor> getter;
|
||||
|
||||
@Autowired
|
||||
SleuthMessagingProperties sleuthMessagingProperties;
|
||||
private final SleuthMessagingProperties sleuthMessagingProperties;
|
||||
|
||||
@Autowired
|
||||
MessageSpanCustomizer messageSpanCustomizer;
|
||||
private final MessageSpanCustomizer messageSpanCustomizer;
|
||||
|
||||
@Autowired
|
||||
ApplicationContext applicationContext;
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
MessageSpanCustomizer defaultMessageSpanCustomizer() {
|
||||
return new DefaultMessageSpanCustomizer();
|
||||
TraceWebSocketAutoConfiguration(Tracer tracer, Propagator propagator,
|
||||
Propagator.Setter<MessageHeaderAccessor> setter, Propagator.Getter<MessageHeaderAccessor> getter,
|
||||
SleuthMessagingProperties sleuthMessagingProperties, MessageSpanCustomizer messageSpanCustomizer,
|
||||
ApplicationContext applicationContext) {
|
||||
this.tracer = tracer;
|
||||
this.propagator = propagator;
|
||||
this.setter = setter;
|
||||
this.getter = getter;
|
||||
this.sleuthMessagingProperties = sleuthMessagingProperties;
|
||||
this.messageSpanCustomizer = messageSpanCustomizer;
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,4 +108,15 @@ class TraceWebSocketAutoConfiguration extends AbstractWebSocketMessageBrokerConf
|
||||
registration.interceptors(tracingChannelInterceptor());
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
MessageSpanCustomizer defaultMessageSpanCustomizer() {
|
||||
return new DefaultMessageSpanCustomizer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,22 +47,17 @@ public class TraceQuartzAutoConfiguration implements InitializingBean {
|
||||
|
||||
private final Scheduler scheduler;
|
||||
|
||||
private final Tracer tracer;
|
||||
|
||||
private final Propagator propagator;
|
||||
private final BeanFactory beanFactory;
|
||||
|
||||
@Deprecated
|
||||
public TraceQuartzAutoConfiguration(Scheduler scheduler, Tracer tracer, Propagator propagator) {
|
||||
this.scheduler = scheduler;
|
||||
this.tracer = tracer;
|
||||
this.propagator = propagator;
|
||||
this(scheduler, null);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
BeanFactory beanFactory;
|
||||
|
||||
@Bean
|
||||
TracingJobListener tracingJobListener() {
|
||||
return new TracingJobListener(this.tracer, this.propagator);
|
||||
public TraceQuartzAutoConfiguration(Scheduler scheduler, BeanFactory beanFactory) {
|
||||
this.scheduler = scheduler;
|
||||
this.beanFactory = beanFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,4 +67,14 @@ public class TraceQuartzAutoConfiguration implements InitializingBean {
|
||||
this.scheduler.getListenerManager().addJobListener(tracingJobListener);
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
TracingJobListener tracingJobListener(Tracer tracer, Propagator propagator) {
|
||||
return new TracingJobListener(tracer, propagator);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,10 +25,19 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.system.CapturedOutput;
|
||||
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||
import org.springframework.cloud.gateway.config.GatewayAutoConfiguration;
|
||||
import org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration;
|
||||
import org.springframework.cloud.gateway.config.GatewayMetricsAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.DisableSecurity;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
@@ -62,7 +71,7 @@ public class BraveAutoConfigurationWithDisabledSleuthTests {
|
||||
public void shouldNotContainAnyTracingInfoInTheLogs(CapturedOutput capture) {
|
||||
log.info("hello");
|
||||
|
||||
// prove bootstrap-disabled.yml loaded
|
||||
// prove application-disabled.yml loaded
|
||||
assertThat(applicationName).isEqualTo("disabledapplication");
|
||||
|
||||
// spring.application.name is put in the log format by
|
||||
@@ -71,7 +80,12 @@ public class BraveAutoConfigurationWithDisabledSleuthTests {
|
||||
BDDAssertions.then(capture.toString()).doesNotContain("[disabledapplication");
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@EnableAutoConfiguration(
|
||||
exclude = { GatewayClassPathWarningAutoConfiguration.class, GatewayAutoConfiguration.class,
|
||||
GatewayMetricsAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class,
|
||||
MongoAutoConfiguration.class, QuartzAutoConfiguration.class, R2dbcAutoConfiguration.class,
|
||||
RedisAutoConfiguration.class, CassandraAutoConfiguration.class },
|
||||
excludeName = "org.springframework.cloud.gateway.config.GatewayRedisAutoConfiguration")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@DisableSecurity
|
||||
static class Config {
|
||||
|
||||
@@ -30,8 +30,16 @@ import org.slf4j.MDC;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.gateway.config.GatewayAutoConfiguration;
|
||||
import org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration;
|
||||
import org.springframework.cloud.gateway.config.GatewayMetricsAutoConfiguration;
|
||||
|
||||
import static brave.propagation.CurrentTraceContext.Scope.NOOP;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -42,9 +50,14 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = { "spring.sleuth.baggage.remote-fields=x-vcap-request-id,country-code",
|
||||
"spring.sleuth.baggage.local-fields=bp", "spring.sleuth.baggage.correlation-fields=country-code,bp",
|
||||
"spring.sleuth.tracer.mode=BRAVE" })
|
||||
"spring.sleuth.tracer.mode=BRAVE", "debug=true" })
|
||||
@SpringBootConfiguration
|
||||
@EnableAutoConfiguration
|
||||
@EnableAutoConfiguration(
|
||||
exclude = { GatewayClassPathWarningAutoConfiguration.class, GatewayAutoConfiguration.class,
|
||||
GatewayMetricsAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class,
|
||||
MongoAutoConfiguration.class, QuartzAutoConfiguration.class, R2dbcAutoConfiguration.class,
|
||||
CassandraAutoConfiguration.class },
|
||||
excludeName = "org.springframework.cloud.gateway.config.GatewayRedisAutoConfiguration")
|
||||
public class CorrelationScopeDecoratorTest {
|
||||
|
||||
static final BaggageField COUNTRY_CODE = BaggageField.create("country-code");
|
||||
|
||||
@@ -27,8 +27,16 @@ import brave.test.TestSpanHandler;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.gateway.config.GatewayAutoConfiguration;
|
||||
import org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration;
|
||||
import org.springframework.cloud.gateway.config.GatewayMetricsAutoConfiguration;
|
||||
import org.springframework.cloud.sleuth.brave.instrument.messaging.ConsumerSampler;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -49,7 +57,12 @@ public class BraveMessagingAutoConfigurationIntegrationTests {
|
||||
then(this.sampler).isNotNull();
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@EnableAutoConfiguration(
|
||||
exclude = { GatewayClassPathWarningAutoConfiguration.class, GatewayAutoConfiguration.class,
|
||||
GatewayMetricsAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class,
|
||||
MongoAutoConfiguration.class, QuartzAutoConfiguration.class, R2dbcAutoConfiguration.class,
|
||||
CassandraAutoConfiguration.class },
|
||||
excludeName = "org.springframework.cloud.gateway.config.GatewayRedisAutoConfiguration")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public static class Config {
|
||||
|
||||
|
||||
@@ -36,8 +36,16 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.gateway.config.GatewayAutoConfiguration;
|
||||
import org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration;
|
||||
import org.springframework.cloud.gateway.config.GatewayMetricsAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -251,7 +259,12 @@ public class OpenTracingTest {
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableAutoConfiguration
|
||||
@EnableAutoConfiguration(
|
||||
exclude = { GatewayClassPathWarningAutoConfiguration.class, GatewayAutoConfiguration.class,
|
||||
GatewayMetricsAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class,
|
||||
MongoAutoConfiguration.class, QuartzAutoConfiguration.class, R2dbcAutoConfiguration.class,
|
||||
CassandraAutoConfiguration.class },
|
||||
excludeName = "org.springframework.cloud.gateway.config.GatewayRedisAutoConfiguration")
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.stereotype.Service;
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@SpringBootTest(classes = { EndpointWithCyclicDependenciesTests.ClientConfig.class },
|
||||
properties = "spring.sleuth.tracer.mode=BRAVE")
|
||||
properties = { "spring.sleuth.tracer.mode=BRAVE", "spring.main.allow-circular-references=true" })
|
||||
public class EndpointWithCyclicDependenciesTests {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -77,16 +78,6 @@ class SleuthSampleApplication {
|
||||
@Autowired
|
||||
private ParticipantsBean participantsBean;
|
||||
|
||||
@Bean
|
||||
public RestTemplate getRestTemplate() {
|
||||
return new RestTemplate();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Sampler defaultSampler() {
|
||||
return Sampler.ALWAYS_SAMPLE;
|
||||
}
|
||||
|
||||
@RequestMapping("/")
|
||||
public String home() {
|
||||
LOG.info("you called home");
|
||||
@@ -103,6 +94,21 @@ class SleuthSampleApplication {
|
||||
return this.environment.getProperty("local.server.port", Integer.class);
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
public RestTemplate getRestTemplate() {
|
||||
return new RestTemplate();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Sampler defaultSampler() {
|
||||
return Sampler.ALWAYS_SAMPLE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Component
|
||||
|
||||
@@ -24,8 +24,10 @@ import org.springframework.cloud.sleuth.annotation.NewSpan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
@ContextConfiguration(classes = SleuthSpanCreatorCircularDependencyTests.TestConfiguration.class)
|
||||
@TestPropertySource(properties = "spring.main.allow-circular-references=true")
|
||||
public abstract class SleuthSpanCreatorCircularDependencyTests {
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user