-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
DUBBO版本:2.7.5
问题描述:使用DUBBO-Samples中的org.apache.dubbo.spring.boot.demo.provider进行测试。一个接口有2个实现类,分别使用@service(group="")来暴露服务。启动时ConfigManger认为2个Service的id是一样的,从日志看确实都是"org.apache.dubbo.spring.boot.demo.consumer.DemoService"。日志请看下面。造成的后果是:注册中心(NACOS)中只有一个服务注册上去。此问题在2.7.3版本不存在,我比较了2个版本的ConfigManager,新版本增加了checkDuplicate功能。
尝试解决:(1)降低到2.7.3版本,问题解决;(2)继续2.7.5版本,使用@service(provider="s1"),来区别两个ServiceBean的ID,又报了其他的错误。 请帮忙解决一下。
用法:
`
@service(group="s1", version = "1.0.0")
public class DefaultDemoService implements DemoService {}
@service(group="s2", version = "1.0.0")
public class DefaultDemoService2 implements DemoService {}
`
日志:
`
2020-03-26 18:34:03.243 INFO 12596 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor : [DUBBO] The BeanDefinition[Root bean: class [org.apache.dubbo.config.spring.ServiceBean]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] of ServiceBean has been registered with name : ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s1, dubbo version: 2.7.5, current host: ...
2020-03-26 18:34:03.246 INFO 12596 --- [ main] b.f.a.ServiceAnnotationBeanPostProcessor : [DUBBO] The BeanDefinition[Root bean: class [org.apache.dubbo.config.spring.ServiceBean]; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] of ServiceBean has been registered with name : ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s2, dubbo version: 2.7.5, current host: ...
2020-03-26 18:34:04.195 WARN 12596 --- [ main] o.a.dubbo.config.context.ConfigManager : [DUBBO] Duplicate ServiceBean found, there already has one default ServiceBean or more than two ServiceBeans have the same id, you can try to give each ServiceBean a different id : <dubbo:service beanName="ServiceBean:org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0:s2" exported="false" unexported="false" ref="org.apache.dubbo.spring.boot.demo.provider.service.DefaultDemoService2@abf688e" prefix="dubbo.service.org.apache.dubbo.spring.boot.demo.consumer.DemoService" uniqueServiceName="s2/org.apache.dubbo.spring.boot.demo.consumer.DemoService:1.0.0" interface="org.apache.dubbo.spring.boot.demo.consumer.DemoService" dynamic="true" version="1.0.0" deprecated="false" group="s2" id="org.apache.dubbo.spring.boot.demo.consumer.DemoService" valid="true" />, dubbo version: 2.7.5, current host: ...
`