make code compile

This commit is contained in:
Spencer Gibb
2017-03-17 18:46:39 -06:00
parent 23f3e461ac
commit d11abd8f5e
18 changed files with 201 additions and 414 deletions

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons-parent</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>2.0.0.BUILD-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
<name>Spring Cloud Commons Docs</name>

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons-parent</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>2.0.0.BUILD-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Spring Cloud Commons Parent</name>
<description>Spring Cloud Commons Parent</description>
@@ -11,7 +11,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>1.3.1.BUILD-SNAPSHOT</version>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<scm>
@@ -47,8 +47,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>

View File

@@ -5,11 +5,11 @@
<parent>
<artifactId>spring-cloud-dependencies-parent</artifactId>
<groupId>org.springframework.cloud</groupId>
<version>1.3.1.BUILD-SNAPSHOT</version>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath/>
</parent>
<artifactId>spring-cloud-commons-dependencies</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>2.0.0.BUILD-SNAPSHOT</version>
<packaging>pom</packaging>
<name>spring-cloud-commons-dependencies</name>
<description>Spring Cloud Commons Dependencies</description>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons-parent</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>spring-cloud-commons</artifactId>

View File

@@ -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<EmbeddedServletContainerInitializedEvent> {
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();
}
}
}

View File

@@ -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 {
}

View File

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

View File

@@ -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<R extends Registration> extends AbstractDiscoveryLifecycle implements AutoServiceRegistration {
public abstract class AbstractAutoServiceRegistration<R extends Registration> 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<R> serviceRegistry;
@@ -31,7 +188,6 @@ public abstract class AbstractAutoServiceRegistration<R extends Registration> 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<R extends Registration> 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<R extends Registration> 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<R extends Registration> 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();

View File

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

View File

@@ -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
*/

View File

@@ -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
*/

View File

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

View File

@@ -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

View File

@@ -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

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons-parent</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>2.0.0.BUILD-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>spring-cloud-context</artifactId>

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons-parent</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>2.0.0.BUILD-SNAPSHOT</version>
</parent>
<artifactId>spring-cloud-starter</artifactId>
<name>spring-cloud-starter</name>