在 SpringCloud 整合熔斷器(Hystrix)時,已經在 Eureka Discovery Client 中加了依賴:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
出現找不到@HystrixCommand注解,
經發現@HystrixCommand注解是屬於 com.netflix.hystrix.contrib.javanica.annotation 包提供,故需要添加以下依賴:
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-javanica</artifactId>
</dependency>
刷新maven即可