这篇博文是临时增长出来的内容,主要是因为最近连载《Spring Cloud Alibaba基础教程》系列的时候,碰到读者咨询的大量问题中存在一个比较广泛的问题:版本的选择。其实这类问题,在以前写Spring Cloud基础教程的时候,就已经发过一篇《聊聊Spring Cloud版本的那些事儿》,来讲明Spring Boot和Spring Cloud版本之间的关系。spring
如今的Spring Cloud Alibaba因为没有归入到Spring Cloud的主版本管理中,因此咱们须要本身去引入其版本信息,好比以前教程中的例子:微服务
<dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Finchley.SR1</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <version>0.2.1.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
而不是像以往使用Spring Cloud的时候,直接引入Spring Cloud的主版本(Dalston、Edgware、Finchley、Greenwich这些)就能够的。咱们须要像上面的例子那样,单独的引入spring-cloud-alibaba-dependencies
来管理Spring Cloud Alibaba下的组件版本。spa
因为Spring Cloud基于Spring Boot构建,而Spring Cloud Alibaba又基于Spring Cloud Common的规范实现,因此当咱们使用Spring Cloud Alibaba来构建微服务应用的时候,须要知道这三者之间的版本关系。调试
下表整理了目前Spring Cloud Alibaba的版本与Spring Boot、Spring Cloud版本的兼容关系:code
Spring Boot | Spring Cloud | Spring Cloud Alibaba |
---|---|---|
2.1.x | Greenwich | 0.2.2(还未RELEASE) |
2.0.x | Finchley | 0.2.1 |
1.5.x | Edgware | 0.1.1 |
1.5.x | Dalston | 0.1.1 |
因此,不论您是在读个人《Spring Boot基础教程》、《Spring Cloud基础教程》仍是正在连载的《Spring Cloud Alibaba系列教程》。当您照着博子的顺序,一步步作下来,可是没有调试成功的时候,强烈建议检查一下,您使用的版本是否符合上表的关系。xml