javamelody部署监控

2019-03-14  本文已影响0人  whisperoy

依赖

<dependency>
           <groupId>net.bull.javamelody</groupId>
           <artifactId>javamelody-core</artifactId>
           <version>1.72.0</version>
 </dependency>

注入bean

@Configuration
public class JavamelodyConfiguration {
    
    @Bean
    public FilterRegistrationBean monitorFilter() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new MonitoringFilter());
        filterRegistrationBean.addUrlPatterns("/*");
        return filterRegistrationBean;
    }

    @Bean
    public ServletListenerRegistrationBean sessionListener() {
        ServletListenerRegistrationBean servletListenerRegistrationBean = new ServletListenerRegistrationBean();
        servletListenerRegistrationBean.setListener(new SessionListener());
        return servletListenerRegistrationBean;
    }
}
上一篇下一篇

猜你喜欢

热点阅读