package hystrixdashboard;
import hystrixdashboard.stream.MockStreamServlet;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Created by sgibb on 7/11/14.
*/
@Configuration
@ComponentScan
@EnableAutoConfiguration
@Controller
@EnableHystrixDashboard
public class HystrixDashboardApplication extends SpringBootServletInitializer {
@RequestMapping("/")
public String home() {
return "forward:/hystrix";
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(HystrixDashboardApplication.class).web(true);
}
public static void main(String[] args) {
new SpringApplicationBuilder(HystrixDashboardApplication.class).web(true).run(args);
}
@Bean
public ServletRegistrationBean mockStreamServlet() {
return new ServletRegistrationBean(new MockStreamServlet(), "/mock.stream");
}
}