詳細錯誤:
*************************** APPLICATION FAILED TO START *************************** Description: An attempt was made to call a method that does not exist. The attempt was made from the following location: org.springframework.cloud.client.discovery.health.DiscoveryCompositeHealthIndicator.<init>(DiscoveryCompositeHealthIndicator.java:42) The following method did not exist: org.springframework.boot.actuate.health.CompositeHealthIndicator.<init>(Lorg/springframework/boot/actuate/health/HealthAggregator;)V The method's class, org.springframework.boot.actuate.health.CompositeHealthIndicator, is available from the following locations: jar:file:/C:/Users/zhao/.m2/repository/org/springframework/boot/spring-boot-actuator/2.2.0.M1/spring-boot-actuator-2.2.0.M1.jar!/org/springframework/boot/actuate/health/CompositeHealthIndicator.class It was loaded from the following location: file:/C:/Users/zhao/.m2/repository/org/springframework/boot/spring-boot-actuator/2.2.0.M1/spring-boot-actuator-2.2.0.M1.jar Action: Correct the classpath of your application so that it contains a single, compatible version of org.springframework.boot.actuate.health.CompositeHealthIndicator
這個問題是springboot 和 springcloud 版本號不一致的問題
比如我的(我的是錯誤的)就是:
SpringBoot 2.2.4.RELEASE
SpringCloud Greenwich.SR1
解決方法
解決方法有如下兩種,我都已經測試過,這兩種方法都可以解決問題
- 降級 SpringBoot
把 SpringBoot 從 2.2.4.RELEASE 降級成 2.1.4.RELEASE - 升級 SpringCloud
把 SpringCloud 從 Greenwich.SR1 升級成 Hoxton.SR1