github上有一个开源项目spring-boot-starter-dubbo 提供了spring-boot与dubbo的集成功能,直接拿来用即可。(记得给作者点赞,以示感谢!)
下面是使用步骤,先看下工程的大致结构:
一、引入相关的依赖项
1 subprojects { 2 buildscript { 3 ext { 4 springBootVersion = '1.5.3.RELEASE' 5 } 6 repositories { 7 mavenLocal() 8 maven { 9 url "http://maven.aliyun.com/nexus/content/groups/public/" 10 } 11 mavenCentral() 12 } 13 dependencies { 14 classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 15 } 16 } 17 18 apply plugin: "java" 19 apply plugin: "maven" 20 apply plugin: 'idea' 21 22 23 targetCompatibility = 1.8 24 sourceCompatibility = 1.8 25 26 repositories { 27 mavenLocal() 28 maven { 29 url "http://maven.aliyun.com/nexus/content/groups/public/" 30 } 31 mavenCentral() 32 } 33 34 configurations.all { 35 resolutionStrategy.cacheChangingModulesFor 1, "minutes" 36 } 37 38 dependencies { 39 compile('io.dubbo.springboot:spring-boot-starter-dubbo:1.0.0') 40 compile('org.springframework.boot:spring-boot-starter-web:1.5.3.RELEASE') 41 } 42 }