#### After reading source code and testing, I located the cause.
- if we set dubbo properties in yml or properties, DubboAutoConfiguration will
work. So actually @EnableDubbo is needless, it just effect DubboComponentScan
- If we set dubbo.scan.basePackages in properties or
@EnableDubbo(scanBasePackages = "xx"), the classes annotated by dubbo @Service
will be managed by spring. But if we use yml and set "dubbo: scan:
base-packages: xx" following the wiki, a error will be thrown. Because even if
we use yml, finally the property is also got from "basePackages", so those
classes annotated by dubbo @Service will not be managed by spring meaning no
privider error
Thus, we can set this as below in yml or use properties or
@EnableDubbo(scanBasePackages = "xx") to set basePackages
```
dubbo:
scan:
basePackages : xx
```
- PS: If using yml or properties, there are warn log in console as below. If
using @EnableDubbo(scanBasePackages = "xx"), there is only first warn log shown.
And I wonder why
```
2018-09-23 19:09:06.153 WARN 6348 --- [ main]
b.f.a.ServiceAnnotationBeanPostProcessor : [DUBBO] The BeanDefinition[Root
bean: class [com.alibaba.dubbo.config.spring.ServiceBean]; scope=;
abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0;
autowireCandidate=true; primary=false; factoryBeanName=null;
factoryMethodName=null; initMethodName=null; destroyMethodName=null] of
ServiceBean has been registered with name :
ServiceBean:defaultDemoService:com.alibaba.boot.dubbo.demo.consumer.DemoService:${demo.service.version},
dubbo version: 2.6.2, current host: 192.168.199.223
2018-09-23 19:09:06.154 WARN 6348 --- [ main]
o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean
definition 'com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration' since
its singleton instance has been created too early. The typical cause is a
non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type:
Consider declaring such methods as 'static'.
```
[ Full content available at:
https://github.com/apache/incubator-dubbo-spring-boot-project/issues/286 ]
This message was relayed via gitbox.apache.org for [email protected]