有了springboot从1.x升级到2.x的经验,以为springcloud也就是换个版本号的事,实际上还是经历了一些波折。
spring官方不会保证SpringBoot和SpringCloud不同版本的兼容性。
要升级,先看springboot与springcloud兼容版本,要不然各种幺蛾子。
SpringCloud版本 | SpringBoot版本 |
---|---|
Hoxton 2.2.x | 2.2.x |
Greenwich 2.1.x | 2.1.x |
Finchley 2.0.x | 2.0.x |
Edgware 1.5.x | 1.5.x |
Dalston 1.5.x | 1.5.x |
Finchley.M2 | >=2.0.0.M3 and <2.0.0.M5 |
Finchley.M3 | >=2.0.0.M5 and <=2.0.0.M5 |
Finchley.M4 | >=2.0.0.M6 and <=2.0.0.M6 |
Finchley.M5 | >=2.0.0.M7 and <=2.0.0.M7 |
Finchley.M6 | >=2.0.0.RC1 and <=2.0.0.RC1 |
Finchley.M7 | >=2.0.0.RC2 and <=2.0.0.RC2 |
Finchley.M9 | >=2.0.0.RELEASE and <=2.0.0.RELEASE |
Finchley.RC1 | >=2.0.1.RELEASE and <2.0.2.RELEASE |
Finchley.RC2 | >=2.0.2.RELEASE and <2.0.3.RELEASE |
Finchley.SR4 | >=2.0.3.RELEASE and <2.0.999.BUILD-SNAPSHOT |
Finchley.BUILD-SNAPSHOT | >=2.0.999.BUILD-SNAPSHOT and <2.1.0.M3 |
Greenwich.M1 | >=2.1.0.M3 and <2.1.0.RELEASE |
Greenwich.SR5 | >=2.1.0.RELEASE and <2.1.14.BUILD-SNAPSHOT |
Greenwich.BUILD-SNAPSHOT | >=2.1.14.BUILD-SNAPSHOT and <2.2.0.M4 |
Hoxton.SR6 | >=2.2.0.M4 and <2.3.0.BUILD-SNAPSHOT |
我这里选择的版本是springboot:2.2.8.RELEASE,springcloud:Hoxton.SR6
首先发现eureka包不一样了
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
eurekaServer起来后,dashboard无法访问了,404找不到
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Jul 23 10:40:09 CST 2020
There was an unexpected error (type=Not Found, status=404).
No message available
据说增加一步配置即可搞定:spring.freemarker.prefer-file-system-access=false
重启后还是不行啊!!!
过程中切换了多次版本号,有的jar包下不动,手工取消了,导致项目编译时很多jar包加载报错了。
xxx.jar.in project 'SpringBoot' cannot be read or is not a valid ZIP file”
到maven仓库中去找到“xxx.jar”删除后重新update Project,问题解决。
还是不行,网上看了好多,都说freemarker配置一行搞定,但是有的人还是不成功。
打开MavenDebug模式,install的时候,发现了几行小小的错误,但是不影响编译成功。
错误: 读取D:\apache-maven-3.2.5\resp\lib\org\freemarker\freemarker\2.3.30\freemarker-2.3.30.jar时出错;
错误: 读取D:\apache-maven-3.2.5\resp\lib\org\glassfish\jaxb\jaxb-runtime\2.3.3\jaxb-runtime-2.3.3.jar时出错;
到maven仓库中去找到“xxx.jar”删除后重新update Project,问题解决。
maven重新加载pom.xml的时候,如果卡住不动了,千万别取消,老美的网站总是连接超时,有些包在ali的仓库也不存在!
I have a dream!jar包秒下!秒下!秒下!
阿里私有仓先到pom.xml
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>