在主类添加@EnableCircuitBreaker或@SpringCloudApplication注解

我这边的springboot是2.4,springcloud是2020.0.0-M5,应该是版本太高造成的

pom.xml里添加

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
会启动报错,如下:
java.lang.IllegalStateException: Annotation @EnableCircuitBreaker found,
but there are no implementations. Did you forget to include a starter?

解决方法:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
<version>2.1.3.RELEASE</version>
</dependency>

参考:
https://blog.csdn.net/qq_24585103/article/details/103126411

版权声明:本文为GGDong原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/GGDong/p/14086579.html