Closed steveguoshao closed 6 years ago
目前的实现是支持spring boot初始化阶段注入配置的,之前也应该测试过的。
你能上传一个demo吗?我们看看是不是一个新的问题?
spring boot dubbo和apollo结合的使用可以参考 https://github.com/ctripcorp/apollo-use-cases/tree/master/spring-boot-dubbo
@nobodyiam 你好,发现我的项目跟demo中的不一样的地方是依赖不同,我用的是
<dependency>
<groupId>io.dubbo.springboot</groupId>
<artifactId>spring-boot-starter-dubbo</artifactId>
<version>1.0.0</version>
<exclusions>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.6.1</version>
</dependency>
而你demo中用的是这个:
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
@steveguoshao
dubbo spring boot starter貌似大家一直有点晕,因为有两个项目。
目前我用的是 incubator-dubbo-spring-boot-project,@mercyblitz 小马哥看看后续是不是给大家点指引。
@steveguoshao 请使用 incubator-dubbo-spring-boot-project
好,谢谢!
case先关闭了,如还有问题,可以提供更多信息,或进群交流。
通过在application.properties中同时添加
apollo.bootstrap.eagerLoad.enabled=true
apollo.bootstrap.enabled=true
至于为什么可以查阅com.ctrip.framework.apollo.spring.boot.ApolloApplicationContextInitializer#postProcessEnvironment这个方法。dubbo-spring-boot-starter在0.2.1之后的版本初始化ApplicationConfig的方式完全不同。可查看dubbo-starter的源码,低版本是通过spring监听创建,早于apollo的starter执行。所以需要在Environment实例化是启动apollo。
在碰到dubbo配置不生效的问题#1040 ,经过测试发现文档中虽然说支持bootstrap.properties,但是经过测试发现application.yml,bootstrap.yml,bootstrap.properties都不支持,希望Apollo在bootstrap阶段注入配置功能增加支持application.yml/boostrap.yml/bootstrap.properties,可以参考spring-cloud-config-client