You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/09/23 11:47:21 UTC

[GitHub] lfz757077613 commented on issue #286: how did it work in sample without @EnableDubbo?

lfz757077613 commented on issue #286: how did it work in sample without @EnableDubbo?
URL: https://github.com/apache/incubator-dubbo-spring-boot-project/issues/286#issuecomment-423810659
 
 
   #### 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'.
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org