配色: 字号:
springcloud不同版本组件依赖你懂多少?
2020-03-09 | 阅:  转:  |  分享 
  
springcloud不同版本组件依赖你懂多少?SpringBoot版本不兼容java.lang.NoSuchMethodError:or
g.springframework.boot.builder.SpringApplicationBuilder.([L
java/lang/Object;)V给出大家一个springboot版本和springcloud版本的匹配关系:Spring
CloudSpringBootHoxton兼容SpringBoot2.2.x,不兼容SpringBoot2.1.xG
reenwich兼容SpringBoot2.1.x,不兼容SpringBoot2.0.xFinchley兼容Sprin
gBoot2.0.x,不兼容SpringBoot1.5.xEdgware兼容SpringBoot1.5.x,不兼容Sp
ringBoot2.0.xDalston兼容SpringBoot1.5.x,不兼容SpringBoot2.0.xCam
den兼容SpringBoot1.4.x,也兼容SpringBoot1.5.xBrixton兼容SpringBoot1
.3.x,也兼容SpringBoot1.4.xAngel兼容SpringBoot1.2.xdependencies与dep
endencyManagement:1、使用dependencies即使在子项目中不写该依赖项,那么子项目仍然会从父项目中继承该依
赖项2、dependencyManagement里只是声明依赖,并不实现引入,因此子项目需要显示的声明需要用的依赖。如果不在子项目
中声明依赖,是不会从父项目中继承下来的;只有在子项目中写了该依赖项,并且没有指定具体版本,才会从父项目中继承该项,并且versio
n和scope都读取自父pom;另外如果子项目中指定了版本号,那么会使用子项目中指定的版本。注意:1、需要maven2.9以上版本
。2、将dependency分类,每一类建立单独的pom文件3、在需要使用到这些依赖的子model中,使用dependencyMa
nagement管理依赖,并importscope依赖3、scope=import只能用在dependencyManagemen
t里面,且仅用于type=pom的dependencySpringCloudFinchley.SR1|Greenwich.SR
11、EurekaServer依赖更新:升级前:org.springframewo
rk.cloud
spring-cloud-starter-eureka-server
升级后:org.springfr
amework.cloud
spring-cloud-starter-netflix-
eureka-server
2、EurekaClient依赖更新:升级前:<
dependency>org.springframework.cloudtId>spring-cloud-starter-eureka升级后:endency>org.springframework.cloud>spring-cloud-starter-netflix-eureka-clientncy>http://turbine-hostname:port/turbine.stream[?cluster=clusterN
ame]3、Ribbon依赖更新升级前:org.springframework.clo
ud
spring-cloud-starter-ribbon<
/dependency>升级后:org.springframework.cloudroupId>spring-cloud-starter-netflix-ribbond>4、hystrix和hystrix-dashboard依赖更新:升级前:<
groupId>org.springframework.cloudspring-clo
ud-starter-hystrix

org.springframework.cloud
spring-cloud-start
er-hystrix-dashboard
升级后:oupId>org.springframework.cloudspring-cloud
-starter-netflix-hystrix
oupId>org.springframework.cloudspring-cloud
-starter-netflix-hystrix-dashboard
turbi
ne:org.springframework.cloudactId>spring-cloud-starter-turbinendency>org.springframework.cloudsp
ring-cloud-starter-netflix-turbine
使用sp
ringboot2.x和springcloudFinchley及以上版本搭建:1、必须使用项目名/actuator/h
ystrix.stream而不是/hystrix.stream为插入点2、启动类注解@EnableHystrix@Enab
leCircuitBreaker@EnableHystrixDashboardfeign:hystrix:enabled:t
rueyml:management:endpoints:web:exposure:include:""#includ
e:hystrix.streamendpoint:health:show-details:ALWAYS5、Feign依
赖更新:(不是加netflix)升级前:org.springframework.clou
d
spring-cloud-starter-feignependency>升级后:org.springframework.cloudupId>spring-cloud-starter-openfeign
endency>注解包路径改了:org.springframework.cloud.openfeign.EnableFeignCl
ients6、zuul依赖更新升级前:org.springframework.clou
d
spring-cloud-starter-zuulpendency>升级后:org.springframework.cloudspring-cloud-starter-netflix-zuulSpringCloud获取服务客户端IP地址配置变更了升级前:${spring.cloud.client.ipAddress}升级后:${spring.cloud.client.ip-address}华大职业教育
献花(0)
+1
(本文系华大职业教...首藏)