Spring Cloud 中的@enablehystrixdas

2019-02-20  本文已影响0人  firststep

今天学习的springcloud的hystrix的时候遇到了一个问题,就是@enablehystrixdashboard的注解无论如何都不能把她的包import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; 引入。我查看了一下pom.xml 发现

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-netflix-hystrix-dashboard</artifactId>
        </dependency>

已经引入了,所以就在网上查看了一下发现是Spring Boot版本的问题。需要把依赖替换一下:

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-netflix-hystrix-dashboard</artifactId>
        </dependency>

替换成

<dependency>
            <groupId>com.netflix.hystrix</groupId>
            <artifactId>hystrix-javanica</artifactId>
            <version>RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-netflix-hystrix-dashboard</artifactId>
        </dependency>

这样就ok了。希望大家写的时候也要多注意一下版本的问题。

上一篇 下一篇

猜你喜欢

热点阅读