Skip to content

2.7版本与spring cloud euerka bean创建冲突 #449

@bruce-qin

Description

@bruce-qin

错误日志:
Field propertyResolver in org.springframework.cloud.netflix.eureka.EurekaClientConfigBean required a single bean, but 2 were found:
- dubboScanBasePackagesPropertyResolver: defined by method 'dubboScanBasePackagesPropertyResolver' in class path resource [org/apache/dubbo/spring/boot/autoconfigure/DubboRelaxedBinding2AutoConfiguration.class]
- environment: a programmatically registered singleton

org.apache.dubbo.spring.boot.autoconfigure.DubboRelaxedBinding2AutoConfiguration

public class DubboRelaxedBinding2AutoConfiguration {
    @Bean(name = BASE_PACKAGES_PROPERTY_RESOLVER_BEAN_NAME)
    public PropertyResolver dubboScanBasePackagesPropertyResolver(ConfigurableEnvironment environment) {
        ConfigurableEnvironment propertyResolver = new AbstractEnvironment() {
            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 propertyResolver;
    }

org.springframework.cloud.netflix.eureka.EurekaClientConfigBean

public class EurekaClientConfigBean implements EurekaClientConfig, Ordered {
        @Autowired(required = false)
	PropertyResolver propertyResolver;

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions