From 73495d2dcc4abc1beef33cc5106402f9d2dc54fe Mon Sep 17 00:00:00 2001 From: theonefx Date: Mon, 9 Mar 2020 11:15:45 +0800 Subject: [PATCH 1/3] remove force dependency code of spring-cloud in AliCloudContextAutoConfiguration --- .../AliCloudContextAutoConfiguration.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java b/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java index 48e03d94f..6f64a5330 100644 --- a/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java +++ b/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java @@ -16,6 +16,7 @@ package com.alibaba.alicloud.context; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.cloud.commons.util.InetUtils; @@ -27,13 +28,23 @@ import org.springframework.context.annotation.Configuration; * @author xiaolongzuo */ @Configuration(proxyBeanMethods = false) -@EnableConfigurationProperties({ AliCloudProperties.class, InetUtilsProperties.class }) public class AliCloudContextAutoConfiguration { - @Bean - @ConditionalOnMissingBean - public InetUtils inetUtils(InetUtilsProperties inetUtilsProperties) { - return new InetUtils(inetUtilsProperties); + @EnableConfigurationProperties(AliCloudProperties.class) + static class AliCloudPropertiesInit { + + } + + @EnableConfigurationProperties(InetUtilsProperties.class) + @ConditionalOnClass(InetUtilsProperties.class) + static class InetUtilsPropertiesInit { + + @Bean + @ConditionalOnMissingBean + public InetUtils inetUtils(InetUtilsProperties inetUtilsProperties) { + return new InetUtils(inetUtilsProperties); + } + } } From c601c174b977f8c412f9266952791ffc872a01a9 Mon Sep 17 00:00:00 2001 From: theonefx Date: Wed, 11 Mar 2020 11:44:59 +0800 Subject: [PATCH 2/3] rename AutoConfiguration class name --- .../alicloud/context/AliCloudContextAutoConfiguration.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java b/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java index 6f64a5330..9202e6b8b 100644 --- a/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java +++ b/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java @@ -31,13 +31,13 @@ import org.springframework.context.annotation.Configuration; public class AliCloudContextAutoConfiguration { @EnableConfigurationProperties(AliCloudProperties.class) - static class AliCloudPropertiesInit { + static class AliCloudPropertiesAutoConfiguration { } @EnableConfigurationProperties(InetUtilsProperties.class) @ConditionalOnClass(InetUtilsProperties.class) - static class InetUtilsPropertiesInit { + static class InetUtilsAutoConfiguration { @Bean @ConditionalOnMissingBean From 23f7a60d0a326354a9666f71c9b007381c38b5e3 Mon Sep 17 00:00:00 2001 From: theonefx Date: Wed, 11 Mar 2020 15:22:49 +0800 Subject: [PATCH 3/3] rename inner config class --- .../alicloud/context/AliCloudContextAutoConfiguration.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java b/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java index 9202e6b8b..e364fc53a 100644 --- a/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java +++ b/spring-cloud-starter-alicloud/spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/AliCloudContextAutoConfiguration.java @@ -26,18 +26,21 @@ import org.springframework.context.annotation.Configuration; /** * @author xiaolongzuo + * @author theonefx */ @Configuration(proxyBeanMethods = false) public class AliCloudContextAutoConfiguration { + @Configuration(proxyBeanMethods = false) @EnableConfigurationProperties(AliCloudProperties.class) - static class AliCloudPropertiesAutoConfiguration { + static class AliCloudPropertiesConfiguration { } + @Configuration(proxyBeanMethods = false) @EnableConfigurationProperties(InetUtilsProperties.class) @ConditionalOnClass(InetUtilsProperties.class) - static class InetUtilsAutoConfiguration { + static class InetUtilsConfiguration { @Bean @ConditionalOnMissingBean