Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when DubboConfigConfigurationRegistrar do registerBeans have unreasonable use #484

Closed
IronCity opened this issue Apr 4, 2019 · 1 comment

Comments

@IronCity
Copy link

IronCity commented Apr 4, 2019

The problem happened in
dubbo-spring-boot-project branch 2.7.x
dubbo 2.7.1

class : DubboConfigConfigurationRegistrar

        // Single Config Bindings
        registerBeans(registry, DubboConfigConfiguration.Single.class);

        if (multiple) { // Since 2.6.6 https://github.com/apache/incubator-dubbo/issues/3193
            registerBeans(registry, DubboConfigConfiguration.Multiple.class);
        }

I found class DubboAutoConfiguration default Multiple,

    @ConditionalOnProperty(prefix = DUBBO_CONFIG_PREFIX, name = MULTIPLE_CONFIG_PROPERTY_NAME, matchIfMissing = true)
    @EnableDubboConfig(multiple = true)
    protected static class MultipleDubboConfigConfiguration {
    }

when matchIfMissing = true, MultipleDubboConfigConfiguration will run, will error by spring

Invalid bean definition with name 'dubboConfigConfiguration.Multiple' defined in null: Cannot register bean definition [Generic bean: class [org.apache.dubbo.config.spring.context.annotation.DubboConfigConfiguration$Multiple]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] for bean 'dubboConfigConfiguration.Multiple': There is already [Generic bean: class [org.apache.dubbo.config.spring.context.annotation.DubboConfigConfiguration$Multiple]; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] bound.

but dubbo 2.7.0 is difference, it will not happen, code as following shows

        if (multiple) { //true
            registerBeans(registry, DubboConfigConfiguration.Multiple.class);
        } else {
            registerBeans(registry, DubboConfigConfiguration.Single.class);
        }

I want to use dubbo 2.7.1 and dubbo-spring-boot-project 2.7.x, I hope not need to add config

dubbo.config.multiple=false
@IronCity IronCity changed the title DubboConfigConfigurationRegistrar do registerBeans Bindings when DubboConfigConfigurationRegistrar do registerBeans have unreasonable use Apr 4, 2019
@mercyblitz
Copy link
Contributor

@see apache/dubbo#3193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants