1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00
mercyblitz 2019-04-09 18:22:15 +08:00
parent e78b6dbaac
commit 42c0c9d2b8

View File

@ -16,6 +16,7 @@
*/ */
package org.springframework.cloud.alibaba.dubbo.autoconfigure; package org.springframework.cloud.alibaba.dubbo.autoconfigure;
import org.springframework.beans.factory.annotation.Autowired;
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.alibaba.dubbo.env.DubboCloudProperties; import org.springframework.cloud.alibaba.dubbo.env.DubboCloudProperties;
@ -28,6 +29,9 @@ import org.springframework.cloud.alibaba.dubbo.service.parameter.RequestParamSer
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertyResolver;
/** /**
* Spring Boot Auto-Configuration class for Dubbo Service * Spring Boot Auto-Configuration class for Dubbo Service
@ -55,81 +59,15 @@ public class DubboServiceAutoConfiguration {
static class ParameterResolversConfiguration { static class ParameterResolversConfiguration {
} }
// /** /**
// * Bugfix code for an issue : https://github.com/apache/incubator-dubbo-spring-boot-project/issues/459 * Build a primary {@link PropertyResolver} bean to {@link Autowired @Autowired}
// * *
// * @param environment {@link ConfigurableEnvironment} * @param environment {@link Environment}
// * @return a Bean of {@link PropertyResolver} * @return alias bean for {@link Environment}
// */ */
// @Primary @Bean
// @Bean(name = BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME) @Primary
// public PropertyResolver dubboScanBasePackagesPropertyResolver(ConfigurableEnvironment environment) { public PropertyResolver primaryPropertyResolver(Environment environment) {
// ConfigurableEnvironment propertyResolver = new AbstractEnvironment() { return environment;
// @Override }
// protected void customizePropertySources(MutablePropertySources propertySources) {
// Map<String, Object> dubboScanProperties = PropertySourcesUtils.getSubProperties(environment, DUBBO_SCAN_PREFIX);
// propertySources.addLast(new MapPropertySource("dubboScanProperties", dubboScanProperties));
// }
// };
// ConfigurationPropertySources.attach(propertyResolver);
// return new DelegatingPropertyResolver(propertyResolver);
// }
//
//
// private static class DelegatingPropertyResolver implements PropertyResolver {
//
// private final PropertyResolver delegate;
//
// DelegatingPropertyResolver(PropertyResolver delegate) {
// Assert.notNull(delegate, "The delegate of PropertyResolver must not be null");
// this.delegate = delegate;
// }
//
// @Override
// public boolean containsProperty(String key) {
// return delegate.containsProperty(key);
// }
//
// @Override
// @Nullable
// public String getProperty(String key) {
// return delegate.getProperty(key);
// }
//
// @Override
// public String getProperty(String key, String defaultValue) {
// return delegate.getProperty(key, defaultValue);
// }
//
// @Override
// @Nullable
// public <T> T getProperty(String key, Class<T> targetType) {
// return delegate.getProperty(key, targetType);
// }
//
// @Override
// public <T> T getProperty(String key, Class<T> targetType, T defaultValue) {
// return delegate.getProperty(key, targetType, defaultValue);
// }
//
// @Override
// public String getRequiredProperty(String key) throws IllegalStateException {
// return delegate.getRequiredProperty(key);
// }
//
// @Override
// public <T> T getRequiredProperty(String key, Class<T> targetType) throws IllegalStateException {
// return delegate.getRequiredProperty(key, targetType);
// }
//
// @Override
// public String resolvePlaceholders(String text) {
// return delegate.resolvePlaceholders(text);
// }
//
// @Override
// public String resolveRequiredPlaceholders(String text) throws IllegalArgumentException {
// return delegate.resolveRequiredPlaceholders(text);
// }
// }
} }