diff --git a/eventuate-tram-spring-cloud-sleuth-tram-consumer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/consumer/TramSpringCloudSleuthIntegrationConsumerAutoConfiguration.java b/eventuate-tram-spring-cloud-sleuth-tram-consumer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/consumer/TramSpringCloudSleuthIntegrationConsumerAutoConfiguration.java index fd674dd..ffe88b5 100644 --- a/eventuate-tram-spring-cloud-sleuth-tram-consumer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/consumer/TramSpringCloudSleuthIntegrationConsumerAutoConfiguration.java +++ b/eventuate-tram-spring-cloud-sleuth-tram-consumer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/consumer/TramSpringCloudSleuthIntegrationConsumerAutoConfiguration.java @@ -1,13 +1,18 @@ package io.eventuate.tram.spring.cloudsleuthintegration.consumer; import io.eventuate.tram.consumer.common.MessageHandlerDecorator; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.cloud.sleuth.autoconfig.brave.BraveAutoConfiguration; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration @Import(TramSpringCloudSleuthIntegrationConsumerConfiguration.class) @ConditionalOnClass(MessageHandlerDecorator.class) +@AutoConfigureAfter(BraveAutoConfiguration.class) +@ConditionalOnProperty(value = "spring.sleuth.enabled", matchIfMissing = true) public class TramSpringCloudSleuthIntegrationConsumerAutoConfiguration { } diff --git a/eventuate-tram-spring-cloud-sleuth-tram-consumer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/consumer/TramSpringCloudSleuthIntegrationSqlTableBasedDuplicatorMessageDetectorAutoConfiguration.java b/eventuate-tram-spring-cloud-sleuth-tram-consumer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/consumer/TramSpringCloudSleuthIntegrationSqlTableBasedDuplicatorMessageDetectorAutoConfiguration.java index dd031f9..74c2ba8 100644 --- a/eventuate-tram-spring-cloud-sleuth-tram-consumer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/consumer/TramSpringCloudSleuthIntegrationSqlTableBasedDuplicatorMessageDetectorAutoConfiguration.java +++ b/eventuate-tram-spring-cloud-sleuth-tram-consumer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/consumer/TramSpringCloudSleuthIntegrationSqlTableBasedDuplicatorMessageDetectorAutoConfiguration.java @@ -1,13 +1,18 @@ package io.eventuate.tram.spring.cloudsleuthintegration.consumer; import io.eventuate.tram.consumer.jdbc.SqlTableBasedDuplicateMessageDetector; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.cloud.sleuth.autoconfig.brave.BraveAutoConfiguration; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration @ConditionalOnClass(SqlTableBasedDuplicateMessageDetector.class) @Import(TramSpringCloudSleuthIntegrationSqlTableBasedDuplicatorMessageDetectorConfiguration.class) +@AutoConfigureAfter(BraveAutoConfiguration.class) +@ConditionalOnProperty(value = "spring.sleuth.enabled", matchIfMissing = true) public class TramSpringCloudSleuthIntegrationSqlTableBasedDuplicatorMessageDetectorAutoConfiguration { } diff --git a/eventuate-tram-spring-cloud-sleuth-tram-producer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/producer/TramSpringCloudSleuthIntegrationProducerAutoConfiguration.java b/eventuate-tram-spring-cloud-sleuth-tram-producer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/producer/TramSpringCloudSleuthIntegrationProducerAutoConfiguration.java index fed3437..32a95c3 100644 --- a/eventuate-tram-spring-cloud-sleuth-tram-producer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/producer/TramSpringCloudSleuthIntegrationProducerAutoConfiguration.java +++ b/eventuate-tram-spring-cloud-sleuth-tram-producer/src/main/java/io/eventuate/tram/spring/cloudsleuthintegration/producer/TramSpringCloudSleuthIntegrationProducerAutoConfiguration.java @@ -1,13 +1,18 @@ package io.eventuate.tram.spring.cloudsleuthintegration.producer; import io.eventuate.tram.messaging.producer.common.MessageProducerImplementation; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.cloud.sleuth.autoconfig.brave.BraveAutoConfiguration; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration @Import(TramSpringCloudSleuthIntegrationProducerConfiguration.class) @ConditionalOnClass(MessageProducerImplementation.class) +@AutoConfigureAfter(BraveAutoConfiguration.class) +@ConditionalOnProperty(value = "spring.sleuth.enabled", matchIfMissing = true) public class TramSpringCloudSleuthIntegrationProducerAutoConfiguration { } diff --git a/eventuate-tram-spring-cloud-sleuth-tram-tests/src/test/java/io/eventuate/tram/spring/cloudsleuthintegration/test/SpringCloudSleuthWhenDisabledIntegrationTest.java b/eventuate-tram-spring-cloud-sleuth-tram-tests/src/test/java/io/eventuate/tram/spring/cloudsleuthintegration/test/SpringCloudSleuthWhenDisabledIntegrationTest.java new file mode 100644 index 0000000..19224d1 --- /dev/null +++ b/eventuate-tram-spring-cloud-sleuth-tram-tests/src/test/java/io/eventuate/tram/spring/cloudsleuthintegration/test/SpringCloudSleuthWhenDisabledIntegrationTest.java @@ -0,0 +1,28 @@ +package io.eventuate.tram.spring.cloudsleuthintegration.test; + +import io.eventuate.tram.spring.inmemory.TramInMemoryConfiguration; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@SpringBootTest(classes= SpringCloudSleuthWhenDisabledIntegrationTest.TestConfiguration.class, webEnvironment = SpringBootTest + .WebEnvironment.NONE, properties = "spring.sleuth.enabled=false") +public class SpringCloudSleuthWhenDisabledIntegrationTest { + + + @Configuration + @EnableAutoConfiguration + @Import(TramInMemoryConfiguration.class) + static class TestConfiguration { + } + + + @Test + public void applicationContextShouldLoad() { + } + + + +}