美文网首页
Spring Cloud 中的@enablehystrixdas

Spring Cloud 中的@enablehystrixdas

作者: firststep | 来源:发表于2019-02-20 10:00 被阅读0次

    今天学习的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了。希望大家写的时候也要多注意一下版本的问题。

    相关文章

      网友评论

          本文标题:Spring Cloud 中的@enablehystrixdas

          本文链接:https://www.haomeiwen.com/subject/mpscyqtx.html