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

2022年10月17日10:16:49

问题描述

添加负载均衡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.cloud</groupId><artifactId>spring-cloud-starter-zuul</artifactId><version>1.4.7.RELEASE</version></dependency>

解决

查看Maven官网,修改引用为

<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-ribbon</artifactId><version>2.2.9.RELEASE</version></dependency>

总结:

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

  • 作者:往事已回首
  • 原文链接:https://blog.csdn.net/qq_44058265/article/details/120751866
    更新时间:2022年10月17日10:16:49 ,共 640 字。