diff --git a/README.adoc b/README.adoc
index 10f8682d..78e78022 100644
--- a/README.adoc
+++ b/README.adoc
@@ -44,7 +44,7 @@ See the https://consul.io/intro/index.html[intro] for more information.
== Building
-:jdkversion: 1.7
+:jdkversion: 1.8
=== Basic Compile and Test
@@ -133,39 +133,6 @@ The generated eclipse projects can be imported by selecting `import existing pro
from the `file` menu.
-==== Adding Project Lombok Agent
-
-Spring Cloud uses http://projectlombok.org/features/index.html[Project Lombok]
-to generate getters and setters etc. Compiling from the command line this
-shouldn't cause any problems, but in an IDE you need to add an agent
-to the JVM. Full instructions can be found in the Lombok website. The
-sign that you need to do this is a lot of compiler errors to do with
-missing methods and fields, e.g.
-
-[indent=0]
-----
-The method getInitialStatus() is undefined for the type EurekaInstanceConfigBean EurekaDiscoveryClientConfiguration.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka line 120 Java Problem
-The method getInitialStatus() is undefined for the type EurekaInstanceConfigBean EurekaDiscoveryClientConfiguration.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka line 121 Java Problem
-The method setNonSecurePort(int) is undefined for the type EurekaInstanceConfigBean EurekaDiscoveryClientConfiguration.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka line 112 Java Problem
-The type EurekaInstanceConfigBean.IdentifyingDataCenterInfo must implement the inherited abstract method DataCenterInfo.getName() EurekaInstanceConfigBean.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/eureka line 131 Java Problem
-The method getId() is undefined for the type ProxyRouteLocator.ProxyRouteSpec PreDecorationFilter.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/pre line 60 Java Problem
-The method getLocation() is undefined for the type ProxyRouteLocator.ProxyRouteSpec PreDecorationFilter.java /spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/pre line 55 Java Problem
-----
-
-==== Importing into Intellij
-Spring Cloud projects use annotation processing, particularly Lombok, which requires configuration
-or you will encounter compile problems. It also needs a specific version of maven and a profile
-enabled. Intellij 14.1+ requires some configuration to ensure these are setup properly.
-
- 1. Click Preferences, Plugins. *Ensure Lombok is installed*
- 2. Click New, Project from Existing Sources, choose your spring-cloud project directory
- 3. Choose Maven, and select Environment Settings. *Ensure you are using Maven 3.3.3*
- 4. In the next screen, *Select the profile `spring`* click Next until Finish.
- 5. Click Preferences, "Build, Execution, Deployment", Compiler, Annotation Processors. *Click Enable Annotation Processing*
- 6. Click Build, Rebuild Project, and you are ready to go!
-
-==== Importing into other IDEs
-Maven is well supported by most Java IDEs. Refer to you vendor documentation.
== Contributing
diff --git a/docs/src/main/asciidoc/README.adoc b/docs/src/main/asciidoc/README.adoc
index 34f02b4b..52bec01c 100644
--- a/docs/src/main/asciidoc/README.adoc
+++ b/docs/src/main/asciidoc/README.adoc
@@ -35,9 +35,7 @@ See the https://consul.io/intro/index.html[intro] for more information.
== Building
-include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building.adoc[]
-
-include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building-lombok.adoc[]
+include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building-jdk8.adoc[]
== Contributing
diff --git a/spring-cloud-consul-binder/pom.xml b/spring-cloud-consul-binder/pom.xml
index cba92802..6c446c57 100644
--- a/spring-cloud-consul-binder/pom.xml
+++ b/spring-cloud-consul-binder/pom.xml
@@ -39,8 +39,7 @@
org.projectlombok
lombok
-
- provided
+ test
org.springframework.cloud
diff --git a/spring-cloud-consul-binder/src/main/java/org/springframework/cloud/consul/binder/config/ConsulBinderProperties.java b/spring-cloud-consul-binder/src/main/java/org/springframework/cloud/consul/binder/config/ConsulBinderProperties.java
index b7dc79f7..ee5988f3 100644
--- a/spring-cloud-consul-binder/src/main/java/org/springframework/cloud/consul/binder/config/ConsulBinderProperties.java
+++ b/spring-cloud-consul-binder/src/main/java/org/springframework/cloud/consul/binder/config/ConsulBinderProperties.java
@@ -16,14 +16,31 @@
package org.springframework.cloud.consul.binder.config;
-import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.core.style.ToStringCreator;
/**
* @author Spencer Gibb
*/
@ConfigurationProperties("spring.cloud.stream.consul.binder")
-@Data
public class ConsulBinderProperties {
private int eventTimeout = 5;
+
+ public ConsulBinderProperties() {
+ }
+
+ public int getEventTimeout() {
+ return this.eventTimeout;
+ }
+
+ public void setEventTimeout(int eventTimeout) {
+ this.eventTimeout = eventTimeout;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringCreator(this)
+ .append("eventTimeout", eventTimeout)
+ .toString();
+ }
}
diff --git a/spring-cloud-consul-core/pom.xml b/spring-cloud-consul-core/pom.xml
index 6cb4f40c..0ccffc05 100644
--- a/spring-cloud-consul-core/pom.xml
+++ b/spring-cloud-consul-core/pom.xml
@@ -85,8 +85,7 @@
org.projectlombok
lombok
-
- provided
+ test
org.springframework.boot
diff --git a/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/ConsulEndpoint.java b/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/ConsulEndpoint.java
index 82fb3b8e..a17711a9 100644
--- a/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/ConsulEndpoint.java
+++ b/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/ConsulEndpoint.java
@@ -20,9 +20,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
-import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
-
import com.ecwid.consul.v1.ConsulClient;
import com.ecwid.consul.v1.QueryParams;
import com.ecwid.consul.v1.Response;
@@ -30,7 +27,9 @@ import com.ecwid.consul.v1.agent.model.Service;
import com.ecwid.consul.v1.catalog.model.CatalogService;
import com.ecwid.consul.v1.catalog.model.Node;
-import lombok.Data;
+import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
+import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
+import org.springframework.core.style.ToStringCreator;
/**
* @author Spencer Gibb
@@ -66,7 +65,6 @@ public class ConsulEndpoint {
return data;
}
- @Data
public static class ConsulData {
Map> catalogServices = new LinkedHashMap<>();
@@ -74,6 +72,40 @@ public class ConsulEndpoint {
List catalogNodes;
- // List keyValues;
+ public ConsulData() {
+ }
+
+ public Map> getCatalogServices() {
+ return this.catalogServices;
+ }
+
+ public Map getAgentServices() {
+ return this.agentServices;
+ }
+
+ public List getCatalogNodes() {
+ return this.catalogNodes;
+ }
+
+ public void setCatalogServices(Map> catalogServices) {
+ this.catalogServices = catalogServices;
+ }
+
+ public void setAgentServices(Map agentServices) {
+ this.agentServices = agentServices;
+ }
+
+ public void setCatalogNodes(List catalogNodes) {
+ this.catalogNodes = catalogNodes;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringCreator(this)
+ .append("catalogServices", catalogServices)
+ .append("agentServices", agentServices)
+ .append("catalogNodes", catalogNodes)
+ .toString();
+ }
}
}
diff --git a/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/RetryProperties.java b/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/RetryProperties.java
index 91888fb2..d371b0f8 100644
--- a/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/RetryProperties.java
+++ b/spring-cloud-consul-core/src/main/java/org/springframework/cloud/consul/RetryProperties.java
@@ -17,14 +17,12 @@
package org.springframework.cloud.consul;
import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import lombok.Data;
+import org.springframework.core.style.ToStringCreator;
/**
* @author Spencer Gibb
*/
@ConfigurationProperties("spring.cloud.consul.retry")
-@Data
public class RetryProperties {
/** Initial retry interval in milliseconds. */
@@ -38,4 +36,49 @@ public class RetryProperties {
/** Maximum number of attempts. */
private int maxAttempts = 6;
+
+ public RetryProperties() {
+ }
+
+ public long getInitialInterval() {
+ return this.initialInterval;
+ }
+
+ public double getMultiplier() {
+ return this.multiplier;
+ }
+
+ public long getMaxInterval() {
+ return this.maxInterval;
+ }
+
+ public int getMaxAttempts() {
+ return this.maxAttempts;
+ }
+
+ public void setInitialInterval(long initialInterval) {
+ this.initialInterval = initialInterval;
+ }
+
+ public void setMultiplier(double multiplier) {
+ this.multiplier = multiplier;
+ }
+
+ public void setMaxInterval(long maxInterval) {
+ this.maxInterval = maxInterval;
+ }
+
+ public void setMaxAttempts(int maxAttempts) {
+ this.maxAttempts = maxAttempts;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringCreator(this)
+ .append("initialInterval", initialInterval)
+ .append("multiplier", multiplier)
+ .append("maxInterval", maxInterval)
+ .append("maxAttempts", maxAttempts)
+ .toString();
+ }
}
diff --git a/spring-cloud-consul-discovery/pom.xml b/spring-cloud-consul-discovery/pom.xml
index ffd098d2..97806dc4 100644
--- a/spring-cloud-consul-discovery/pom.xml
+++ b/spring-cloud-consul-discovery/pom.xml
@@ -111,8 +111,7 @@
org.projectlombok
lombok
-
- provided
+ test
org.springframework.boot
diff --git a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulCatalogWatch.java b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulCatalogWatch.java
index 7585affb..e77a3f08 100644
--- a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulCatalogWatch.java
+++ b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulCatalogWatch.java
@@ -27,7 +27,8 @@ import com.ecwid.consul.v1.ConsulClient;
import com.ecwid.consul.v1.QueryParams;
import com.ecwid.consul.v1.Response;
import io.micrometer.core.annotation.Timed;
-import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.client.discovery.event.HeartbeatEvent;
import org.springframework.context.ApplicationEventPublisher;
@@ -39,8 +40,8 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
/**
* @author Spencer Gibb
*/
-@Slf4j
public class ConsulCatalogWatch implements ApplicationEventPublisherAware, SmartLifecycle {
+ private static final Log log = LogFactory.getLog(ConsulDiscoveryClient.class);
private final ConsulDiscoveryProperties properties;
private final ConsulClient consul;
@@ -123,8 +124,10 @@ public class ConsulCatalogWatch implements ApplicationEventPublisherAware, Smart
catalogServicesIndex.set(BigInteger.valueOf(consulIndex));
}
- log.trace("Received services update from consul: {}, index: {}",
- response.getValue(), consulIndex);
+ if (log.isTraceEnabled()) {
+ log.trace("Received services update from consul: "+response.getValue()
+ +", index: "+ consulIndex);
+ }
publisher.publishEvent(new HeartbeatEvent(this, consulIndex));
}
catch (Exception e) {
diff --git a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClient.java b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClient.java
index 0387d87a..fbcc5c1f 100644
--- a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClient.java
+++ b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClient.java
@@ -20,28 +20,29 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import com.ecwid.consul.v1.ConsulClient;
+import com.ecwid.consul.v1.QueryParams;
+import com.ecwid.consul.v1.Response;
+import com.ecwid.consul.v1.health.model.HealthService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.util.StringUtils;
-import com.ecwid.consul.v1.ConsulClient;
-import com.ecwid.consul.v1.QueryParams;
-import com.ecwid.consul.v1.Response;
-import com.ecwid.consul.v1.health.model.HealthService;
-
import static org.springframework.cloud.consul.discovery.ConsulServerUtils.findHost;
import static org.springframework.cloud.consul.discovery.ConsulServerUtils.getMetadata;
-import lombok.extern.apachecommons.CommonsLog;
-
/**
* @author Spencer Gibb
* @author Joe Athman
*/
-@CommonsLog
public class ConsulDiscoveryClient implements DiscoveryClient {
+ private static final Log log = LogFactory.getLog(ConsulDiscoveryClient.class);
+
@Deprecated
public interface LocalResolver {
String getInstanceId();
diff --git a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulServerUtils.java b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulServerUtils.java
index 23ca1f66..0a453237 100644
--- a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulServerUtils.java
+++ b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulServerUtils.java
@@ -25,18 +25,19 @@ import java.util.List;
import java.util.Map;
import com.ecwid.consul.v1.health.model.HealthService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.springframework.util.StringUtils;
-import lombok.extern.apachecommons.CommonsLog;
-
/**
* @author Spencer Gibb
* @author Semenkov Alexey
*/
-@CommonsLog
public class ConsulServerUtils {
+ private static final Log log = LogFactory.getLog(ConsulServerUtils.class);
+
public static String findHost(HealthService healthService) {
HealthService.Service service = healthService.getService();
HealthService.Node node = healthService.getNode();
diff --git a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/HealthServiceServerListFilter.java b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/HealthServiceServerListFilter.java
index 0b522f71..25e5448b 100644
--- a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/HealthServiceServerListFilter.java
+++ b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/HealthServiceServerListFilter.java
@@ -21,15 +21,16 @@ import java.util.List;
import com.netflix.loadbalancer.Server;
import com.netflix.loadbalancer.ServerListFilter;
-
-import lombok.extern.apachecommons.CommonsLog;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* ServerList implementaion that filters ConsulServers based on if all their Health Checks are PASSING.
* @author Spencer Gibb
*/
-@CommonsLog
public class HealthServiceServerListFilter implements ServerListFilter {
+ private static final Log log = LogFactory.getLog(HealthServiceServerListFilter.class);
+
@Override
public List getFilteredListOfServers(List servers) {
List filtered = new ArrayList<>();
@@ -43,7 +44,9 @@ public class HealthServiceServerListFilter implements ServerListFilter {
}
} else {
- log.debug("Unable to determine aliveness of server type "+server.getClass()+", "+server);
+ if (log.isDebugEnabled()) {
+ log.debug("Unable to determine aliveness of server type " + server.getClass() + ", " + server);
+ }
filtered.add(server);
}
}
diff --git a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/HeartbeatProperties.java b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/HeartbeatProperties.java
index 1d9f4e30..1ddb4863 100644
--- a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/HeartbeatProperties.java
+++ b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/HeartbeatProperties.java
@@ -16,25 +16,23 @@
package org.springframework.cloud.consul.discovery;
-import javax.annotation.PostConstruct;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
-import lombok.Data;
-
-import lombok.extern.apachecommons.CommonsLog;
+import org.apache.commons.logging.Log;
import org.joda.time.Period;
+
import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.core.style.ToStringCreator;
import org.springframework.validation.annotation.Validated;
@ConfigurationProperties(prefix = "spring.cloud.consul.discovery.heartbeat")
-@Data
-@CommonsLog
@Validated
public class HeartbeatProperties {
+ private static final Log log = org.apache.commons.logging.LogFactory.getLog(HeartbeatProperties.class);
// TODO: change enabled to default to true when I stop seeing messages like
// [WARN] agent: Check 'service:testConsulApp:xtest:8080' missed TTL, is now critical
boolean enabled = false;
@@ -66,4 +64,46 @@ public class HeartbeatProperties {
public String getTtl() {
return ttlValue + ttlUnit;
}
+
+ public boolean isEnabled() {
+ return this.enabled;
+ }
+
+ public @Min(1) int getTtlValue() {
+ return this.ttlValue;
+ }
+
+ public @NotNull String getTtlUnit() {
+ return this.ttlUnit;
+ }
+
+ public @DecimalMin("0.1") @DecimalMax("0.9") double getIntervalRatio() {
+ return this.intervalRatio;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public void setTtlValue(@Min(1) int ttlValue) {
+ this.ttlValue = ttlValue;
+ }
+
+ public void setTtlUnit(@NotNull String ttlUnit) {
+ this.ttlUnit = ttlUnit;
+ }
+
+ public void setIntervalRatio(@DecimalMin("0.1") @DecimalMax("0.9") double intervalRatio) {
+ this.intervalRatio = intervalRatio;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringCreator(this)
+ .append("enabled", enabled)
+ .append("ttlValue", ttlValue)
+ .append("ttlUnit", ttlUnit)
+ .append("intervalRatio", intervalRatio)
+ .toString();
+ }
}
diff --git a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/TtlScheduler.java b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/TtlScheduler.java
index eae5da4f..67a8e482 100644
--- a/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/TtlScheduler.java
+++ b/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/TtlScheduler.java
@@ -21,20 +21,20 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledFuture;
-import org.springframework.scheduling.TaskScheduler;
-import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler;
-
import com.ecwid.consul.v1.ConsulClient;
import com.ecwid.consul.v1.agent.model.NewService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
-import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.TaskScheduler;
+import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler;
/**
* Created by nicu on 11.03.2015.
* @author Stéphane LEROY
*/
-@Slf4j
public class TtlScheduler {
+ private static final Log log = LogFactory.getLog(ConsulDiscoveryClient.class);
private final Map serviceHeartbeats = new ConcurrentHashMap<>();
@@ -89,7 +89,9 @@ public class TtlScheduler {
@Override
public void run() {
client.agentCheckPass(checkId);
- log.debug("Sending consul heartbeat for: " + checkId);
+ if (log.isDebugEnabled()) {
+ log.debug("Sending consul heartbeat for: " + checkId);
+ }
}
}
}