问题描述

添加负载均衡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>

总结:

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


版权声明:本文为qq_44058265原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/qq_44058265/article/details/120751866