Skip to content

Commit

Permalink
#4 Fix configuration problem when SPRING_SLEUTH_ENABLED=false
Browse files Browse the repository at this point in the history
  • Loading branch information
cer committed Oct 23, 2023
1 parent 1282d8f commit 638c2e0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 {

}
Original file line number Diff line number Diff line change
@@ -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 {

}
Original file line number Diff line number Diff line change
@@ -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 {

}
Original file line number Diff line number Diff line change
@@ -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() {
}



}

0 comments on commit 638c2e0

Please sign in to comment.