Dubbo外部化配置(application.properties或application.yaml配置)
Dubbo一开始推出的时候, 主推的是xml方式, 鉴于现在Spring框架或者Spring Boot框架所支持的更流行的配置方式, 是把各种应用的配置集成到application.properties或application.yaml中, 也就是所谓的外部化配置(External Configuration).
简直是强迫症福音, 只需要引入以下依赖
<dependency>
<groupId>com.alibaba.spring.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
然后瞄一眼在官方文档中关于各种配置方式的差异: http://dubbo.apache.org/zh-cn/docs/user/configuration/configuration-load-process.html
或者配置demo工程: https://blog.csdn.net/penyoudi1/article/details/79930745
收工
================================================
依赖应该可以使用另外一个(没实测有什么差异)
<!-- https://mvnrepository.com/artifact/org.apache.dubbo/dubbo-spring-boot-starter -->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>2.7.8</version>
</dependency>
参考链接:
1.dubbo-spring-boot项目: https://github.com/alibaba/dubbo-spring-boot-starter/blob/master/README_zh.md
2.dubbo官网关于外部配置方式的详细文档: http://dubbo.apache.org/zh-cn/blog/dubbo-externalized-configuration.html
3.配置加载优先级:http://dubbo.apache.org/zh-cn/docs/user/configuration/properties.html
dubbo自动配置: https://github.com/apache/dubbo-spring-boot-project/tree/master/dubbo-spring-boot-autoconfigure