apache / apache/dubbo

two consumer beans are created.

Open
#3,618 0 comments 0 reactions 1 assignee Claimed by @mercyblitz View on GitHub
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

Hi,
Every one.
I use dubbo spring-boot with

```xml

com.alibaba.boot
dubbo-spring-boot-starter
0.2.0

```

And in order to decouple with dubbo .
I do not use @Service (com.alibaba.dubbo.config.annotation.Service) annotation on my serviceImpl class , but add @Component annotation to them.
Then I config the service and refrence in another two xml file as

```xml


```

to regist the bean to zookeeper as a service.
Finally I use

```java
@ImportResource(locations = {"classpath:META-INF/dubbo/provider.xml"})
```

on the bootstrap class of my springboot application.
Then it works.

But when I config the consumer , a problem happened.
In my application.properties I set a property as
dubbo.consumer.check=false
to skip the exist check of provider
and I need a filter to do some work before a RPC request send,so I configed a filter on my xml file

```xml

```

when the application start

```sh
2019-03-07 15:23:14.672 WARN 4116 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ecAuthMenuI18n': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Duplicate consumer configs: and
```

I think the first tag is from the xml and the secod tag is from the application.properties.

then I try to add a id parameter on my xml file like

```xml

```

the warn info is :

```sh
2019-03-07 16:56:32.498 WARN 6504 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ecAuthMenuI18n': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Duplicate consumer configs: and
```

So I think dubbo can only config one in a context.

Can we consider to imporve this in the future ?

我们在使用dubbo的过程中,希望可以很容易的在rpc模式和本地模式之间切换,所以并没有使用dubbo的@service注解和@refrence注解。而是使用@component注解将service的实现类注册到spring
再用额外的xml分别定义dubbo的service和refrence

```xml


```

在springboot的启动类中分别引入consumer和provider的xml配置。
现在我需要在consumer端加一个filter,于是,我在xml中增加了

```xml

```

由于原来在application.properties中指定了
dubbo.consumer.check=false

启动报错:

```sh
2019-03-07 15:23:14.672 WARN 4116 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ecAuthMenuI18n': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Duplicate consumer configs: and
```

xml中的标签加了个id

```xml

```

报错:

```xml
2019-03-07 16:56:32.498 WARN 6504 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ecAuthMenuI18n': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Duplicate consumer configs: and
```

我想这个是由于dubbo只能接受一个配置的原因吗?
这个是否能够作为一个issue提出来,后续加以改进呢?

谢谢。

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.