作者:夢幻朵顏
出處:https://www.cnblogs.com/zhuwenjoyce/
你的一個點贊,一句留言,都將是博主的前進動力!!!
版權:本文版權歸作者和博客園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責任的權利。
SpringBoot與SpringCloud的版本對應詳細版
大版本對應:
Spring Boot | Spring Cloud |
---|---|
1.2.x | Angel版本 |
1.3.x | Brixton版本 |
1.4.x stripes | Camden版本 |
1.5.x | Dalston版本、Edgware版本 |
2.0.x | Finchley版本 |
2.1.x | Greenwich.SR2 |
在實際開發過程中,我們需要更詳細的版本對應 (https://start.spring.io/actuator/info):
spring-boot-starter-parent | spring-cloud-dependencies | ||||
---|---|---|---|---|---|
版本號 | 發佈日期 | 版本號 | 發佈日期 | ||
1.5.2.RELEASE | 2017年3月 | 穩定版 | Dalston.RC1 | 2017年未知月 | |
1.5.9.RELEASE | 2017年11月 | 穩定版 | Edgware.RELEASE | 2017年11月 | 穩定版 |
1.5.16.RELEASE | Edgware.SR5 | ||||
1.5.20.RELEASE | Edgware.SR5 | ||||
Spring Boot >=2.0.0.M3 and <2.0.0.M5 | Finchley.M2 | ||||
Spring Boot >=2.0.0.M5 and <=2.0.0.M5 | Finchley.M3 | ||||
Spring Boot >=2.0.0.M6 and <=2.0.0.M6 | Finchley.M4 | ||||
Spring Boot >=2.0.0.M7 and <=2.0.0.M7 | Finchley.M5 | ||||
Spring Boot >=2.0.0.RC1 and <=2.0.0.RC1 | Finchley.M6 | ||||
Spring Boot >=2.0.0.RC2 and <=2.0.0.RC2 | Finchley.M7 | ||||
Spring Boot >=2.0.0.RELEASE and <=2.0.0.RELEASE | Finchley.M9 | ||||
Spring Boot >=2.0.1.RELEASE and <2.0.2.RELEASE | Finchley.RC1 | ||||
Spring Boot >=2.0.2.RELEASE and <2.0.3.RELEASE | Finchley.RC2 | ||||
Spring Boot >=2.0.3.RELEASE and <2.0.999.BUILD-SNAPSHOT | Finchley.SR4 | ||||
Spring Boot >=2.0.999.BUILD-SNAPSHOT and <2.1.0.M3 | Finchley.BUILD-SNAPSHOT | ||||
Spring Boot >=2.1.0.M3 and <2.1.0.RELEASE | Greenwich.M1 | ||||
Spring Boot >=2.1.0.RELEASE and <2.1.9.BUILD-SNAPSHOT | Greenwich.SR2 | ||||
Spring Boot >=2.1.9.BUILD-SNAPSHOT and <2.2.0.M4 | Greenwich.BUILD-SNAPSHOT | ||||
Spring Boot >=2.2.0.M4 and <=2.2.0.M5 | Hoxton.M2 | ||||
Spring Boot >=2.2.0.BUILD-SNAPSHOT | Hoxton.BUILD-SNAPSHOT | ||||
待更新... |
spring官方對應查看網址:https://start.spring.io/actuator/info
spring-cloud Finchley.M2 "Spring Boot >=2.0.0.M3 and <2.0.0.M5" Finchley.M3 "Spring Boot >=2.0.0.M5 and <=2.0.0.M5" Finchley.M4 "Spring Boot >=2.0.0.M6 and <=2.0.0.M6" Finchley.M5 "Spring Boot >=2.0.0.M7 and <=2.0.0.M7" Finchley.M6 "Spring Boot >=2.0.0.RC1 and <=2.0.0.RC1" Finchley.M7 "Spring Boot >=2.0.0.RC2 and <=2.0.0.RC2" Finchley.M9 "Spring Boot >=2.0.0.RELEASE and <=2.0.0.RELEASE" Finchley.RC1 "Spring Boot >=2.0.1.RELEASE and <2.0.2.RELEASE" Finchley.RC2 "Spring Boot >=2.0.2.RELEASE and <2.0.3.RELEASE" Finchley.SR4 "Spring Boot >=2.0.3.RELEASE and <2.0.999.BUILD-SNAPSHOT" Finchley.BUILD-SNAPSHOT "Spring Boot >=2.0.999.BUILD-SNAPSHOT and <2.1.0.M3" Greenwich.M1 "Spring Boot >=2.1.0.M3 and <2.1.0.RELEASE" Greenwich.SR2 "Spring Boot >=2.1.0.RELEASE and <2.1.9.BUILD-SNAPSHOT" Greenwich.BUILD-SNAPSHOT "Spring Boot >=2.1.9.BUILD-SNAPSHOT and <2.2.0.M4" Hoxton.M2 "Spring Boot >=2.2.0.M4 and <=2.2.0.M5" Hoxton.BUILD-SNAPSHOT "Spring Boot >=2.2.0.BUILD-SNAPSHOT"
spring-cloud-dependencies 版本列表可查看:
https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-dependencies
spring-boot-starter-parent 版本列表可查看:
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent
在SpringCloud中,1.X和2.X版本在pom.xml中引入的jar包名字都不一樣,比如有的叫spirng-cloud-starter-hystrix 有的叫spring-cloud-netflix-hystrix,維護起來會比較困難。
1.x版本pom.xml裏幾個基本用到的jar長這樣:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.joyce</groupId>
<artifactId>joyce-test</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath />
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Edgware.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<!-- 排除spring boot默認使用的tomcat,使用jetty -->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
在SpringBoot 1.5.9.RELEASE 版本中,junit測試類模版長這樣:
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.RestTemplate;
@RunWith(SpringRunner.class)
@SpringBootTest(classes=MyApplication.class)
public class MyApplicationTest {
private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(MyApplicationTest.class);
@Autowired
private RestTemplate restTemplate;
@Test
public void test() {
System.out.println("ok!!!");
}
@Test
public void orderName() {
try {
String name = "joyce";
String rr = restTemplate.getForObject("http://joyce-user/orderName?name="+name, String.class);
LOG.info("rr====" + rr);
} catch (Exception e) {
e.printStackTrace();
}
}
}