Fixed not compiling code

This commit is contained in:
Marcin Grzejszczak
2017-10-18 13:56:57 +02:00
parent 7cb320b6c7
commit 2974a50c0c

View File

@@ -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"));
}
}