依赖
<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;
}
}