diff --git a/docs/pom.xml b/docs/pom.xml
index eb17efef..231ae3e4 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -6,7 +6,7 @@
org.springframework.cloud
spring-cloud-commons-parent
- 1.2.0.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
pom
Spring Cloud Commons Docs
diff --git a/pom.xml b/pom.xml
index b9eb03ce..4049312b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
org.springframework.cloud
spring-cloud-commons-parent
- 1.2.0.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
pom
Spring Cloud Commons Parent
Spring Cloud Commons Parent
@@ -11,7 +11,7 @@
org.springframework.cloud
spring-cloud-build
- 1.3.1.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
@@ -47,8 +47,8 @@
org.apache.maven.plugins
maven-compiler-plugin
- 1.7
- 1.7
+ 1.8
+ 1.8
diff --git a/spring-cloud-commons-dependencies/pom.xml b/spring-cloud-commons-dependencies/pom.xml
index 641b2ce0..da90675d 100644
--- a/spring-cloud-commons-dependencies/pom.xml
+++ b/spring-cloud-commons-dependencies/pom.xml
@@ -5,11 +5,11 @@
spring-cloud-dependencies-parent
org.springframework.cloud
- 1.3.1.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
spring-cloud-commons-dependencies
- 1.2.0.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
pom
spring-cloud-commons-dependencies
Spring Cloud Commons Dependencies
diff --git a/spring-cloud-commons/pom.xml b/spring-cloud-commons/pom.xml
index 499bf410..48d2ad05 100644
--- a/spring-cloud-commons/pom.xml
+++ b/spring-cloud-commons/pom.xml
@@ -6,7 +6,7 @@
org.springframework.cloud
spring-cloud-commons-parent
- 1.2.0.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
..
spring-cloud-commons
diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/AbstractDiscoveryLifecycle.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/AbstractDiscoveryLifecycle.java
deleted file mode 100644
index ea528386..00000000
--- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/AbstractDiscoveryLifecycle.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright 2013-2015 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.client.discovery;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.annotation.PreDestroy;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.BeansException;
-import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent;
-import org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent;
-import org.springframework.cloud.client.serviceregistry.ServiceRegistry;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.context.ApplicationListener;
-import org.springframework.core.env.Environment;
-
-/**
- * Lifecycle methods that may be useful and common to various DiscoveryClient implementations.
- *
- * @deprecated use {@link org.springframework.cloud.client.serviceregistry.AbstractAutoServiceRegistration} instead. This class will be removed in the next release train.
- *
- * @author Spencer Gibb
- */
-@Deprecated
-public abstract class AbstractDiscoveryLifecycle implements DiscoveryLifecycle,
- ApplicationContextAware, ApplicationListener {
-
- private static final Log logger = LogFactory.getLog(AbstractDiscoveryLifecycle.class);
-
- private boolean autoStartup = true;
-
- private AtomicBoolean running = new AtomicBoolean(false);
-
- private int order = 0;
-
- private ApplicationContext context;
-
- private Environment environment;
-
- private AtomicInteger port = new AtomicInteger(0);
-
- protected ApplicationContext getContext() {
- return context;
- }
-
- @Override
- public void setApplicationContext(ApplicationContext applicationContext)
- throws BeansException {
- this.context = applicationContext;
- this.environment = this.context.getEnvironment();
- }
-
- @Deprecated
- protected Environment getEnvironment() {
- return environment;
- }
-
- @Deprecated
- protected AtomicInteger getPort() {
- return port;
- }
-
- @Override
- public boolean isAutoStartup() {
- return this.autoStartup;
- }
-
- @Override
- public void stop(Runnable callback) {
- try {
- stop();
- } catch (Exception e) {
- logger.error("A problem occurred attempting to stop discovery lifecycle", e);
- }
- callback.run();
- }
-
- @Override
- public void start() {
- if (!isEnabled()) {
- if (logger.isDebugEnabled()) {
- logger.debug("Discovery Lifecycle disabled. Not starting");
- }
- return;
- }
-
- // only set the port if the nonSecurePort is 0 and this.port != 0
- if (this.port.get() != 0 && getConfiguredPort() == 0) {
- setConfiguredPort(this.port.get());
- }
- // only initialize if nonSecurePort is greater than 0 and it isn't already running
- // because of containerPortInitializer below
- if (!this.running.get() && getConfiguredPort() > 0) {
- register();
- if (shouldRegisterManagement()) {
- registerManagement();
- }
- this.context.publishEvent(new InstanceRegisteredEvent<>(this,
- getConfiguration()));
- this.running.compareAndSet(false, true);
- }
- }
-
- @Deprecated
- protected abstract int getConfiguredPort();
- @Deprecated
- protected abstract void setConfiguredPort(int port);
-
- /**
- * @return if the management service should be registered with the {@link ServiceRegistry}
- */
- protected boolean shouldRegisterManagement() {
- return getManagementPort() != null && ManagementServerPortUtils.isDifferent(this.context);
- }
-
- /**
- * @return the object used to configure the registration
- */
- @Deprecated
- protected abstract Object getConfiguration();
-
-
- /**
- * Register the local service with the DiscoveryClient
- */
- protected abstract void register();
-
- /**
- * Register the local management service with the DiscoveryClient
- */
- protected void registerManagement() {
- }
-
- /**
- * De-register the local service with the DiscoveryClient
- */
- protected abstract void deregister();
-
- /**
- * De-register the local management service with the DiscoveryClient
- */
- protected void deregisterManagement() {
- }
-
- /**
- * @return true, if the {@link DiscoveryLifecycle} is enabled
- */
- protected abstract boolean isEnabled();
-
- /**
- * @return the serviceId of the Management Service
- */
- @Deprecated
- protected String getManagementServiceId() {
- // TODO: configurable management suffix
- return this.context.getId() + ":management";
- }
-
- /**
- * @return the service name of the Management Service
- */
- @Deprecated
- protected String getManagementServiceName() {
- // TODO: configurable management suffix
- return getAppName() + ":management";
- }
-
- /**
- * @return the management server port
- */
- @Deprecated
- protected Integer getManagementPort() {
- return ManagementServerPortUtils.getPort(this.context);
- }
-
- /**
- * @return the app name, currently the spring.application.name property
- */
- @Deprecated
- protected String getAppName() {
- return this.environment.getProperty("spring.application.name", "application");
- }
-
- @Override
- public void stop() {
- if (this.running.compareAndSet(true, false) && isEnabled()) {
- deregister();
- if (shouldRegisterManagement()) {
- deregisterManagement();
- }
- }
- }
-
- @PreDestroy
- public void destroy() {
- stop();
- }
-
- @Override
- public boolean isRunning() {
- return this.running.get();
- }
-
- protected AtomicBoolean getRunning() {
- return running;
- }
-
- @Override
- public int getOrder() {
- return this.order;
- }
-
- @Override
- public int getPhase() {
- return 0;
- }
-
- @Override
- @Deprecated
- public void onApplicationEvent(EmbeddedServletContainerInitializedEvent event) {
- // TODO: take SSL into account
- // Don't register the management port as THE port
- if (!"management".equals(event.getApplicationContext().getNamespace())) {
- this.port.compareAndSet(0, event.getEmbeddedServletContainer().getPort());
- this.start();
- }
- }
-}
diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/DiscoveryLifecycle.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/DiscoveryLifecycle.java
deleted file mode 100644
index cd7252b1..00000000
--- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/DiscoveryLifecycle.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2013-2015 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.client.discovery;
-
-import org.springframework.context.SmartLifecycle;
-import org.springframework.core.Ordered;
-
-/**
- * @author Spencer Gibb
- * @deprecated use {@link org.springframework.cloud.client.serviceregistry.AutoServiceRegistration} instead. This class will be removed in the next release train.
- */
-@Deprecated
-public interface DiscoveryLifecycle extends SmartLifecycle, Ordered {
-}
diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/noop/NoopDiscoveryClientAutoConfiguration.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/noop/NoopDiscoveryClientAutoConfiguration.java
index 1e2678a9..424d5930 100644
--- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/noop/NoopDiscoveryClientAutoConfiguration.java
+++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/discovery/noop/NoopDiscoveryClientAutoConfiguration.java
@@ -25,8 +25,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.web.ServerProperties;
-import org.springframework.boot.context.embedded.EmbeddedServletContainer;
-import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.DefaultServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
@@ -124,13 +122,14 @@ public class NoopDiscoveryClientAutoConfiguration
return new PortFinder() {
@Override
public Integer findPort() {
- if (context instanceof EmbeddedWebApplicationContext) {
+ // TODO: support reactive
+ /*if (context instanceof EmbeddedWebApplicationContext) {
EmbeddedServletContainer container = ((EmbeddedWebApplicationContext) context)
.getEmbeddedServletContainer();
if (container != null) {
return container.getPort();
}
- }
+ }*/
return null;
}
};
diff --git a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/serviceregistry/AbstractAutoServiceRegistration.java b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/serviceregistry/AbstractAutoServiceRegistration.java
index 960ad191..92cc86a1 100644
--- a/spring-cloud-commons/src/main/java/org/springframework/cloud/client/serviceregistry/AbstractAutoServiceRegistration.java
+++ b/spring-cloud-commons/src/main/java/org/springframework/cloud/client/serviceregistry/AbstractAutoServiceRegistration.java
@@ -1,6 +1,17 @@
package org.springframework.cloud.client.serviceregistry;
-import org.springframework.cloud.client.discovery.AbstractDiscoveryLifecycle;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.cloud.client.discovery.ManagementServerPortUtils;
+import org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.core.env.Environment;
+
+import javax.annotation.PreDestroy;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
/**
* Lifecycle methods that may be useful and common to {@link ServiceRegistry} implementations.
@@ -12,7 +23,153 @@ import org.springframework.cloud.client.discovery.AbstractDiscoveryLifecycle;
* @author Spencer Gibb
*/
@SuppressWarnings("deprecation")
-public abstract class AbstractAutoServiceRegistration extends AbstractDiscoveryLifecycle implements AutoServiceRegistration {
+public abstract class AbstractAutoServiceRegistration implements AutoServiceRegistration, ApplicationContextAware {
+ private static final Log logger = LogFactory.getLog(AbstractAutoServiceRegistration.class);
+
+ private boolean autoStartup = true;
+
+ private AtomicBoolean running = new AtomicBoolean(false);
+
+ private int order = 0;
+
+ private ApplicationContext context;
+
+ private Environment environment;
+
+ private AtomicInteger port = new AtomicInteger(0);
+
+ protected ApplicationContext getContext() {
+ return context;
+ }
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext)
+ throws BeansException {
+ this.context = applicationContext;
+ this.environment = this.context.getEnvironment();
+ }
+
+ @Deprecated
+ protected Environment getEnvironment() {
+ return environment;
+ }
+
+ @Deprecated
+ protected AtomicInteger getPort() {
+ return port;
+ }
+
+ public boolean isAutoStartup() {
+ return this.autoStartup;
+ }
+
+ public void start() {
+ if (!isEnabled()) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Discovery Lifecycle disabled. Not starting");
+ }
+ return;
+ }
+
+ /*// only set the port if the nonSecurePort is 0 and this.port != 0
+ if (this.port.get() != 0 && getConfiguredPort() == 0) {
+ setConfiguredPort(this.port.get());
+ }
+ // only initialize if nonSecurePort is greater than 0 and it isn't already running
+ // because of containerPortInitializer below
+ if (!this.running.get() && getConfiguredPort() > 0) {
+ register();
+ if (shouldRegisterManagement()) {
+ registerManagement();
+ }
+ this.context.publishEvent(new InstanceRegisteredEvent<>(this,
+ getConfiguration()));
+ this.running.compareAndSet(false, true);
+ }*/
+ }
+
+ /**
+ * @return if the management service should be registered with the {@link ServiceRegistry}
+ */
+ protected boolean shouldRegisterManagement() {
+ return getManagementPort() != null && ManagementServerPortUtils.isDifferent(this.context);
+ }
+
+ /**
+ * @return the object used to configure the registration
+ */
+ @Deprecated
+ protected abstract Object getConfiguration();
+
+
+ /**
+ * @return true, if this is enabled
+ */
+ protected abstract boolean isEnabled();
+
+ /**
+ * @return the serviceId of the Management Service
+ */
+ @Deprecated
+ protected String getManagementServiceId() {
+ // TODO: configurable management suffix
+ return this.context.getId() + ":management";
+ }
+
+ /**
+ * @return the service name of the Management Service
+ */
+ @Deprecated
+ protected String getManagementServiceName() {
+ // TODO: configurable management suffix
+ return getAppName() + ":management";
+ }
+
+ /**
+ * @return the management server port
+ */
+ @Deprecated
+ protected Integer getManagementPort() {
+ return ManagementServerPortUtils.getPort(this.context);
+ }
+
+ /**
+ * @return the app name, currently the spring.application.name property
+ */
+ @Deprecated
+ protected String getAppName() {
+ return this.environment.getProperty("spring.application.name", "application");
+ }
+ @PreDestroy
+ public void destroy() {
+ stop();
+ }
+
+ public boolean isRunning() {
+ return this.running.get();
+ }
+
+ protected AtomicBoolean getRunning() {
+ return running;
+ }
+
+ public int getOrder() {
+ return this.order;
+ }
+
+ public int getPhase() {
+ return 0;
+ }
+
+ /*@Deprecated
+ public void onApplicationEvent(EmbeddedServletContainerInitializedEvent event) {
+ // TODO: take SSL into account
+ // Don't register the management port as THE port
+ if (!"management".equals(event.getApplicationContext().getNamespace())) {
+ this.port.compareAndSet(0, event.getEmbeddedServletContainer().getPort());
+ this.start();
+ }
+ }*/
private ServiceRegistry serviceRegistry;
@@ -31,7 +188,6 @@ public abstract class AbstractAutoServiceRegistration ex
/**
* Register the local service with the {@link ServiceRegistry}
*/
- @Override
protected void register() {
this.serviceRegistry.register(getRegistration());
}
@@ -39,7 +195,6 @@ public abstract class AbstractAutoServiceRegistration ex
/**
* Register the local management service with the {@link ServiceRegistry}
*/
- @Override
protected void registerManagement() {
this.serviceRegistry.register(getManagementRegistration());
}
@@ -47,7 +202,6 @@ public abstract class AbstractAutoServiceRegistration ex
/**
* De-register the local service with the {@link ServiceRegistry}
*/
- @Override
protected void deregister() {
this.serviceRegistry.deregister(getRegistration());
}
@@ -55,12 +209,10 @@ public abstract class AbstractAutoServiceRegistration ex
/**
* De-register the local management service with the {@link ServiceRegistry}
*/
- @Override
protected void deregisterManagement() {
this.serviceRegistry.deregister(getManagementRegistration());
}
- @Override
public void stop() {
if (this.getRunning().compareAndSet(true, false) && isEnabled()) {
deregister();
diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/AbstractDiscoveryLifecycleTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/AbstractDiscoveryLifecycleTests.java
deleted file mode 100644
index d5d71dcb..00000000
--- a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/discovery/AbstractDiscoveryLifecycleTests.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.springframework.cloud.client.discovery;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
-import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
-
-/**
- * @author Spencer Gibb
- */
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = AbstractDiscoveryLifecycleTests.Config.class,
- properties = "management.port=0", webEnvironment = RANDOM_PORT)
-public class AbstractDiscoveryLifecycleTests {
-
- @Autowired
- private TestDiscoveryLifecycle lifecycle;
-
- @Value("${local.server.port}")
- private int port;
-
- @Value("${local.management.port}")
- private int managementPort;
-
- @Test
- public void portsWork() {
- assertNotEquals("Lifecycle port is zero", 0, lifecycle.getPort().get());
- assertNotEquals("Lifecycle port is management port", managementPort, lifecycle.getPort().get());
- assertEquals("Lifecycle port is wrong", port, lifecycle.getPort().get());
- assertTrue("Lifecycle not running", lifecycle.isRunning());
- assertTrue("Lifecycle not registered", lifecycle.isRegistered());
- assertEquals("Lifecycle appName is wrong", "application", lifecycle.getAppName());
- }
-
- @EnableAutoConfiguration
- @Configuration
- public static class Config {
- @Bean
- public TestDiscoveryLifecycle testDiscoveryLifecycle() {
- return new TestDiscoveryLifecycle();
- }
- }
-
- public static class TestDiscoveryLifecycle extends AbstractDiscoveryLifecycle {
- private int port = 0;
- private boolean registered = false;
- private boolean deregistered = false;
-
- @Override
- protected int getConfiguredPort() {
- return port;
- }
-
- @Override
- protected void setConfiguredPort(int port) {
- this.port = port;
- }
-
- @Override
- protected Object getConfiguration() {
- return this;
- }
-
- @Override
- protected void register() {
- this.registered = true;
- }
-
- @Override
- protected void deregister() {
- this.deregistered = true;
- }
-
- @Override
- protected boolean isEnabled() {
- return true;
- }
-
- public boolean isRegistered() {
- return registered;
- }
-
- public boolean isDeregistered() {
- return deregistered;
- }
- }
-}
diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/hypermedia/DiscoveredResourceUnitTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/hypermedia/DiscoveredResourceUnitTests.java
index 599322d7..9a7b949a 100644
--- a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/hypermedia/DiscoveredResourceUnitTests.java
+++ b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/hypermedia/DiscoveredResourceUnitTests.java
@@ -15,11 +15,6 @@
*/
package org.springframework.cloud.client.hypermedia;
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,6 +28,16 @@ import org.springframework.hateoas.client.Traverson.TraversalBuilder;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestOperations;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
/**
* @author Oliver Gierke
*/
diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/hypermedia/DynamicServiceInstanceProviderUnitTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/hypermedia/DynamicServiceInstanceProviderUnitTests.java
index a7ac5bd0..405e1c3f 100644
--- a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/hypermedia/DynamicServiceInstanceProviderUnitTests.java
+++ b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/hypermedia/DynamicServiceInstanceProviderUnitTests.java
@@ -15,11 +15,6 @@
*/
package org.springframework.cloud.client.hypermedia;
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
-
import java.util.Arrays;
import org.junit.Test;
@@ -29,6 +24,13 @@ import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
/**
* @author Oliver Gierke
*/
diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/AbstractAutoServiceRegistrationTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/AbstractAutoServiceRegistrationTests.java
index e669c576..50f88de1 100644
--- a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/AbstractAutoServiceRegistrationTests.java
+++ b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/AbstractAutoServiceRegistrationTests.java
@@ -119,12 +119,10 @@ public class AbstractAutoServiceRegistrationTests {
super(new TestServiceRegistry());
}
- @Override
protected int getConfiguredPort() {
return port;
}
- @Override
protected void setConfiguredPort(int port) {
this.port = port;
}
diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/endpoint/ServiceRegistryEndpointNoRegistrationTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/endpoint/ServiceRegistryEndpointNoRegistrationTests.java
index ede5645b..a8576e0e 100644
--- a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/endpoint/ServiceRegistryEndpointNoRegistrationTests.java
+++ b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/endpoint/ServiceRegistryEndpointNoRegistrationTests.java
@@ -5,10 +5,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
-import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
+import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
-import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
-import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
+import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.client.serviceregistry.ServiceRegistry;
import org.springframework.cloud.client.serviceregistry.endpoint.ServiceRegistryEndpointTests.TestServiceRegistry;
@@ -54,7 +53,8 @@ public class ServiceRegistryEndpointNoRegistrationTests {
@Import({JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class,
- ManagementServerPropertiesAutoConfiguration.class})
+ // ManagementServerPropertiesAutoConfiguration.class
+ })
@Configuration
public static class TestConfiguration {
@Bean
diff --git a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/endpoint/ServiceRegistryEndpointTests.java b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/endpoint/ServiceRegistryEndpointTests.java
index 64fd5291..9a8eb16f 100644
--- a/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/endpoint/ServiceRegistryEndpointTests.java
+++ b/spring-cloud-commons/src/test/java/org/springframework/cloud/client/serviceregistry/endpoint/ServiceRegistryEndpointTests.java
@@ -5,10 +5,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
-import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
+import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
-import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
-import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
+import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.client.serviceregistry.Registration;
import org.springframework.cloud.client.serviceregistry.ServiceRegistry;
@@ -66,7 +65,8 @@ public class ServiceRegistryEndpointTests {
@Import({JacksonAutoConfiguration.class,
HttpMessageConvertersAutoConfiguration.class,
EndpointWebMvcAutoConfiguration.class, WebMvcAutoConfiguration.class,
- ManagementServerPropertiesAutoConfiguration.class})
+ // ManagementServerPropertiesAutoConfiguration.class
+ })
@Configuration
public static class TestConfiguration {
@Bean
diff --git a/spring-cloud-context/pom.xml b/spring-cloud-context/pom.xml
index f668bfb2..cb41aa42 100644
--- a/spring-cloud-context/pom.xml
+++ b/spring-cloud-context/pom.xml
@@ -6,7 +6,7 @@
org.springframework.cloud
spring-cloud-commons-parent
- 1.2.0.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
..
spring-cloud-context
diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/LifecycleMvcEndpointAutoConfiguration.java b/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/LifecycleMvcEndpointAutoConfiguration.java
index 39af35d4..09ca48b8 100644
--- a/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/LifecycleMvcEndpointAutoConfiguration.java
+++ b/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/LifecycleMvcEndpointAutoConfiguration.java
@@ -23,7 +23,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
-import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
+import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.cloud.context.environment.EnvironmentManager;
import org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint;
import org.springframework.cloud.context.restart.RestartEndpoint;
@@ -45,6 +45,7 @@ import org.springframework.context.annotation.Configuration;
@ConditionalOnClass(EnvironmentEndpoint.class)
@ConditionalOnWebApplication
@ConditionalOnBean(RestartEndpoint.class)
+//TODO: support reactive
@AutoConfigureAfter({ WebMvcAutoConfiguration.class,
RefreshEndpointAutoConfiguration.class })
public class LifecycleMvcEndpointAutoConfiguration {
diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/RefreshAutoConfiguration.java b/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/RefreshAutoConfiguration.java
index 6ee17ede..36ccf711 100644
--- a/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/RefreshAutoConfiguration.java
+++ b/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/RefreshAutoConfiguration.java
@@ -26,7 +26,7 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProce
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
+import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.cloud.context.environment.EnvironmentManager;
import org.springframework.cloud.context.refresh.ContextRefresher;
import org.springframework.cloud.context.scope.refresh.RefreshScope;
@@ -46,6 +46,7 @@ import org.springframework.stereotype.Component;
*/
@Configuration
@ConditionalOnClass(RefreshScope.class)
+//TODO: support reactive
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
public class RefreshAutoConfiguration {
diff --git a/spring-cloud-starter/pom.xml b/spring-cloud-starter/pom.xml
index 2b6f9605..b7770a02 100644
--- a/spring-cloud-starter/pom.xml
+++ b/spring-cloud-starter/pom.xml
@@ -5,7 +5,7 @@
org.springframework.cloud
spring-cloud-commons-parent
- 1.2.0.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
spring-cloud-starter
spring-cloud-starter