关于springboot启动时报错 [org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.clas

问题描述

添加负载均衡Ribbon后,启动springboot时 [org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class] cannot be opened because it does not exist报错

原因

jar版本问题,ServerPropertiesAutoConfiguration,在springboot 2.x.x 以后移除了,当springboot>=2.x.x ,其他jar包加载 涉及到ServerPropertiesAutoConfiguration 就会报错了+

我引用的是

<dependency><groupId>org.springframework.cloudgroupId><artifactId>spring-cloud-starter-zuulartifactId><version>1.4.7.RELEASEversion>dependency>

解决

查看Maven官网,修改引用为

<dependency><groupId>org.springframework.cloudgroupId><artifactId>spring-cloud-starter-netflix-ribbonartifactId><version>2.2.9.RELEASEversion>dependency>

总结:

版本要对应,否则就会出现各种报错

Chile Address 版权所有
Powered by WordPress