解决:java.lang.IllegalStateException: Annotation @EnableCircuitBreaker found, but there are no implementations. Did you forget to include a starter?
在主类添加@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