hystrix.stream 访问一直ping并且Hystrix Dashboard 一直loading的问题

现象描述在访问hystrix.stream一直ping
hystrix.stream 访问一直ping并且Hystrix Dashboard 一直loading的问题_第1张图片
Hystrix Dashboard一直loading 如图:
hystrix.stream 访问一直ping并且Hystrix Dashboard 一直loading的问题_第2张图片

依赖加了

       
            org.springframework.cloud
            spring-cloud-starter-netflix-hystrix
        

        
            org.springframework.boot
            spring-boot-starter-actuator
        

注解加了:

@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker
@EnableFeignClients//PROVIDER
public class ClientApplication {
    public static void main(String[] args) {
        SpringApplication.run(ClientApplication.class, args);
    }
}

配置文件也加了:

management:
  endpoints:
    web:
      exposure:
        include: env,health,metrics,info,hystrix.stream

调用方法也写了:

@RestController
public class ClientController {
    @Autowired
    private DemoClient demoClient;

    @RequestMapping("query")
    public String query() {
        return demoClient.query();
    }
}

还是不好使,为啥呢?
因为方法上面没有加注解 @HystrixCommand

@RestController
public class ClientController {
    @Autowired
    private DemoClient demoClient;

    @HystrixCommand(fallbackMethod = "fail2")
    @RequestMapping("query")
    public String query() {
        return demoClient.query();
    }

    private String fail2() {
        System.out.println("fail2");
        throw new RuntimeException();
    }
}

加上注解重启启动 在调用就好使了,原理还不太懂。继续研究中。。。
hystrix.stream 访问一直ping并且Hystrix Dashboard 一直loading的问题_第3张图片
hystrix.stream 访问一直ping并且Hystrix Dashboard 一直loading的问题_第4张图片

你可能感兴趣的:(java,spring-cloud)