idea2019 maven 3.3.9 dubbo2.7.5
springboot集成dubbo一定要引入dubbo-spring-boot-starter 依赖
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>2.7.5</version>
</dependency>
不能引入dubbo
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<version>2.7.5</version>
</dependency>
dubbo-spring-boot-starter 有自动装配能力。单独引入dubbo包不能获取application.properties配置。
造成错误一错误三。
切记切记!!!!!
application.properties内容如下
spring.application.name=spring-boot-dubbo-demo
dubbo.application.name=spring-boot-provider
dubbo.protocol.name=dubbo
dubbo.protocol.port=20880
dubbo.registry.address=N/A
点击=前部分可以跳入对应的类。否则,引入依赖有问题。
错误一,没有引入dubbo-spring-boot-starter
No application config found or it's not a valid config!
Please add <dubbo:application name="..." />
to your spring config.
错误2,配置名称不对称
Caused by: java.lang.IllegalArgumentException:
Could not resolve placeholder 'dubbo.applicatio.name'
in value "${dubbo.applicatio.name}"
错误3 没有引入dubbo-spring-boot-starter
java.lang.NullPointerException: null
at org.apache.dubbo.config.bootstrap
.DubboBootstrap.unexportMetadataService(DubboBootstrap.java:857) ~[dubbo-2.7.5.jar:2.7.5]