From 46d92bb19017b44bc97445b64366b6aea77ccae2 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Tue, 13 Feb 2018 09:23:06 +0000 Subject: [PATCH] Fix class name change and port clash in tests --- .../ConfigurationPropertiesRebinderAutoConfiguration.java | 6 +++--- .../cloud/autoconfigure/RefreshAutoConfiguration.java | 2 -- .../context/properties/ConfigurationPropertiesBeans.java | 6 +++--- .../cloud/autoconfigure/RefreshAutoConfigurationTests.java | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.java b/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.java index 1680fef0..b3b9ad68 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/autoconfigure/ConfigurationPropertiesRebinderAutoConfiguration.java @@ -20,7 +20,7 @@ import org.springframework.beans.factory.SmartInitializingSingleton; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.SearchStrategy; -import org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata; +import org.springframework.boot.context.properties.ConfigurationBeanFactoryMetaData; import org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor; import org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessorRegistrar; import org.springframework.cloud.context.properties.ConfigurationPropertiesBeans; @@ -49,10 +49,10 @@ public class ConfigurationPropertiesRebinderAutoConfiguration // cause a cascade of bean instantiation. Knowing the *name* of the beans we // need is super optimal, but a little brittle (unfortunately we have no // choice). - ConfigurationBeanFactoryMetadata metaData = this.context.getBean( + ConfigurationBeanFactoryMetaData metaData = this.context.getBean( ConfigurationPropertiesBindingPostProcessorRegistrar.BINDER_BEAN_NAME + ".store", - ConfigurationBeanFactoryMetadata.class); + ConfigurationBeanFactoryMetaData.class); ConfigurationPropertiesBeans beans = new ConfigurationPropertiesBeans(); beans.setBeanMetaDataStore(metaData); return beans; 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 de601fd8..f9de157d 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 @@ -28,7 +28,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 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; import org.springframework.cloud.endpoint.event.RefreshEventListener; @@ -36,7 +35,6 @@ import org.springframework.cloud.logging.LoggingRebinder; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.stereotype.Component; /** diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/context/properties/ConfigurationPropertiesBeans.java b/spring-cloud-context/src/main/java/org/springframework/cloud/context/properties/ConfigurationPropertiesBeans.java index f655e500..04eb0f86 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/context/properties/ConfigurationPropertiesBeans.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/context/properties/ConfigurationPropertiesBeans.java @@ -23,7 +23,7 @@ import java.util.Set; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.boot.context.properties.ConfigurationBeanFactoryMetadata; +import org.springframework.boot.context.properties.ConfigurationBeanFactoryMetaData; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; @@ -41,7 +41,7 @@ import org.springframework.stereotype.Component; public class ConfigurationPropertiesBeans implements BeanPostProcessor, ApplicationContextAware { - private ConfigurationBeanFactoryMetadata metaData; + private ConfigurationBeanFactoryMetaData metaData; private Map beans = new HashMap(); @@ -76,7 +76,7 @@ ApplicationContextAware { /** * @param beans the bean meta data to set */ - public void setBeanMetaDataStore(ConfigurationBeanFactoryMetadata beans) { + public void setBeanMetaDataStore(ConfigurationBeanFactoryMetaData beans) { this.metaData = beans; } diff --git a/spring-cloud-context/src/test/java/org/springframework/cloud/autoconfigure/RefreshAutoConfigurationTests.java b/spring-cloud-context/src/test/java/org/springframework/cloud/autoconfigure/RefreshAutoConfigurationTests.java index f7c072c2..49b1a210 100644 --- a/spring-cloud-context/src/test/java/org/springframework/cloud/autoconfigure/RefreshAutoConfigurationTests.java +++ b/spring-cloud-context/src/test/java/org/springframework/cloud/autoconfigure/RefreshAutoConfigurationTests.java @@ -40,7 +40,7 @@ public class RefreshAutoConfigurationTests { private static ConfigurableApplicationContext getApplicationContext( WebApplicationType type, Class configuration, String... properties) { - return new SpringApplicationBuilder(configuration).web(type).properties(properties).run(); + return new SpringApplicationBuilder(configuration).web(type).properties(properties).properties("server.port=0").run(); } @Configuration