Fixes gh-1417 Remove ConditionalOnProperty for supporting yaml (#1418)

This commit is contained in:
Ingyu Hwang
2019-08-05 16:47:21 +09:00
committed by Marcin Grzejszczak
parent facce03f00
commit 2713950aef
3 changed files with 17 additions and 4 deletions

View File

@@ -41,7 +41,6 @@ public class SleuthTagPropagationAutoConfiguration {
protected static class TagPropagationConfiguration {
@Bean
@ConditionalOnProperty("spring.sleuth.propagation.tag.whitelisted-keys")
public FinishedSpanHandler finishedSpanHandler(SleuthProperties sleuthProperties,
SleuthTagPropagationProperties tagPropagationProperties) {
return new TagPropagationFinishedSpanHandler(sleuthProperties,

View File

@@ -31,9 +31,10 @@ public class SleuthTagPropagationAutoConfigurationTests {
AutoConfigurations.of(SleuthTagPropagationAutoConfiguration.class));
@Test
public void shouldNotCreateHandler() {
this.contextRunner.run((context) -> {
assertThat(context).doesNotHaveBean(TagPropagationFinishedSpanHandler.class);
public void shouldCreateHandlerByDefault() {
this.contextRunner
.withUserConfiguration(TraceAutoConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(TagPropagationFinishedSpanHandler.class);
});
}
@@ -60,4 +61,14 @@ public class SleuthTagPropagationAutoConfigurationTests {
});
}
@Test
public void shouldCreateHandlerWithYml() {
this.contextRunner
.withPropertyValues(
"spring.profiles.active=tag-propagation")
.withUserConfiguration(TraceAutoConfiguration.class).run((context) -> {
assertThat(context)
.hasSingleBean(TagPropagationFinishedSpanHandler.class);
});
}
}

View File

@@ -0,0 +1,3 @@
spring.sleuth.propagation.tag.whitelisted-keys:
- foo
- bar