引入了Hystrix依赖却找不到@HystrixCommand注解


问题引入

今天在按照视频学习Spring Cloud Hystrix时,发现报红说找不到@HystrixCommand注解,pom文件中已经引入了hystrix依赖。

<dependency>
    <groupId>org.springframework.cloudgroupId>
    <artifactId>spring-cloud-netflix-hystrixartifactId>
dependency>

解决

上网查阅相关资料后发现需要额外引入依赖hystrix-javanica,在pom文件文件新引入如下依赖即可。

<dependency>
    <groupId>com.netflix.hystrixgroupId>
    <artifactId>hystrix-javanicaartifactId>
dependency>