Merge pull request #1240 from theonefx/fix/temp01

remove force dependency code of spring-cloud in AliCloudContextAutoCo…
pull/2089/head^2
Mercy Ma 5 years ago committed by GitHub
commit aec251469f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,6 +16,7 @@
package com.alibaba.alicloud.context; package com.alibaba.alicloud.context;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.commons.util.InetUtils; import org.springframework.cloud.commons.util.InetUtils;
@ -25,15 +26,28 @@ import org.springframework.context.annotation.Configuration;
/** /**
* @author xiaolongzuo * @author xiaolongzuo
* @author <a href="mailto:chenxilzx1@gmail.com">theonefx</a>
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties({ AliCloudProperties.class, InetUtilsProperties.class })
public class AliCloudContextAutoConfiguration { public class AliCloudContextAutoConfiguration {
@Bean @Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean @EnableConfigurationProperties(AliCloudProperties.class)
public InetUtils inetUtils(InetUtilsProperties inetUtilsProperties) { static class AliCloudPropertiesConfiguration {
return new InetUtils(inetUtilsProperties);
}
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(InetUtilsProperties.class)
@ConditionalOnClass(InetUtilsProperties.class)
static class InetUtilsConfiguration {
@Bean
@ConditionalOnMissingBean
public InetUtils inetUtils(InetUtilsProperties inetUtilsProperties) {
return new InetUtils(inetUtilsProperties);
}
} }
} }

Loading…
Cancel
Save