这部分是provider的配置:
在通过main方法启动后已经成功将服务注册到zk上,
这部分是consumer的单元测试配置:
包扫描:
测试方法:
最后报错如下:
求助,谢谢
巴扎黑2017-04-18 10:26:44
Check if there are any annotations on your SpeakInterface class, or the annotations of other classes also have the same name
The log shows that it is repeatedly defined
PHPz2017-04-18 10:26:44
Your speakInterface bean id has the same name globally. The easiest way is to change the current bean ID to another one and that should be enough.
It is recommended that you put the consumer test code into another project instead of the provider in the same project for an interview
迷茫2017-04-18 10:26:44
Since you are testing under the same project, don’t repeat the bean name
Consumer
Producer
Look at the red box and think carefully whether the bean managed by spring has the same name? Just change the ID of one of them and try it again.
In addition, I remember that dubbo looks for services on zk based on package name-class name. You can use zkClient to check this. It is similar to cxf's webservice. It has nothing to do with bean id, but has something to do with class (interface)