From 2974a50c0c8e43a85f77e2525df43d88a1e56ca6 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Wed, 18 Oct 2017 13:56:57 +0200 Subject: [PATCH] Fixed not compiling code --- .../zipkin2/sender/ZipkinSenderCondition.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderCondition.java b/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderCondition.java index d7ac381fa..db1809500 100644 --- a/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderCondition.java +++ b/spring-cloud-sleuth-zipkin2/src/main/java/org/springframework/cloud/sleuth/zipkin2/sender/ZipkinSenderCondition.java @@ -3,11 +3,11 @@ package org.springframework.cloud.sleuth.zipkin2.sender; import org.springframework.boot.autoconfigure.condition.ConditionMessage; import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; -import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; import org.springframework.core.type.AnnotationMetadata; import org.springframework.core.type.ClassMetadata; +import org.springframework.util.StringUtils; import static org.springframework.cloud.sleuth.zipkin2.sender.ZipkinSenderConfigurationImportSelector.getType; @@ -21,17 +21,15 @@ class ZipkinSenderCondition extends SpringBootCondition { sourceClass = ((ClassMetadata) md).getClassName(); } ConditionMessage.Builder message = ConditionMessage.forCondition("ZipkinSender", sourceClass); - RelaxedPropertyResolver resolver = new RelaxedPropertyResolver( - context.getEnvironment(), "spring.zipkin.sender."); - if (!resolver.containsProperty("type")) { + String property = context.getEnvironment() + .getProperty("spring.zipkin.sender.type"); + if (StringUtils.isEmpty(property)) { return ConditionOutcome.match(message.because("automatic sender type")); } - String senderType = getType(((AnnotationMetadata) md).getClassName()); - String value = resolver.getProperty("type"); - if (value.equals(senderType)) { - return ConditionOutcome.match(message.because(value + " sender type")); + if (property.equals(senderType)) { + return ConditionOutcome.match(message.because(property + " sender type")); } - return ConditionOutcome.noMatch(message.because(value + " sender type")); + return ConditionOutcome.noMatch(message.because(property + " sender type")); } }