git add .

This commit is contained in:
罗祥
2019-01-16 14:24:37 +08:00
parent 7c3e42909c
commit c19c349fd5
19 changed files with 206 additions and 38 deletions

View File

@ -15,7 +15,17 @@ import org.springframework.context.annotation.Bean;
@EnableHystrixDashboard
public class ConsumerApplication {
@Bean
public static void main(String[] args) {
SpringApplication.run(ConsumerApplication.class, args);
}
/*
* 这种方式对servlet进行注册和在配置文件中开启端点是等效的
* 可以在启动的监控日志中看到端点的注册信息:
* o.s.b.a.e.web.ServletEndpointRegistrar : Registered '/actuator/hystrix.stream' to hystrix.stream-actuator-endpoint
@Bean
public ServletRegistrationBean getServlet() {
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
@ -23,11 +33,7 @@ public class ConsumerApplication {
registrationBean.addUrlMappings("/actuator/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
public static void main(String[] args) {
SpringApplication.run(ConsumerApplication.class, args);
}
}*/
}

View File

@ -0,0 +1,17 @@
package com.heibaiying.consumer.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author : heibaiying
*/
@RestController
public class CustomController {
@GetMapping("consumers")
public String queryCustoms() {
return "用户产品偏好列表生成中,请月底再获取";
}
}

View File

@ -1,5 +1,5 @@
server:
port: 8080
port: 8030
# 指定服务命名
spring:
application:
@ -9,4 +9,10 @@ eureka:
client:
serviceUrl:
defaultZone: http://localhost:8010/eureka/
management:
endpoints:
web:
exposure:
# 需要开启hystrix.stream端点的暴露 这样才能获取到监控信息 * 代表开启可监控端点
include: "*"