How to monitor the process of springboot project based on javamelody
This article is about how to monitor the process of springboot projects based on javamelody. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. Related links
Official document https://github.com/javamelody/javamelody/wiki/UserGuide
Download address https://github.com/javamelody/javamelody/releases
two。 Basic integration
Add to 1.pom
Net.bull.javamelody javamelody-core 1.79.0
Add to the 2.springboot startup file
Public class App {public static void main (String [] args) {SpringApplication.run (App.class, args);} / * configure javamelody monitoring spring boot to filter * / @ Bean @ Order (Integer.MAX_VALUE-1) public FilterRegistrationBean monitoringFilter () {FilterRegistrationBean registration = new FilterRegistrationBean (); registration.setFilter (new MonitoringFilter ()); registration.addUrlPatterns ("/ *"); registration.setName ("monitoring"); return registration according to the order value. } / * configure the javamelody listener sessionListener * / @ Bean public ServletListenerRegistrationBean servletListenerRegistrationBean () {ServletListenerRegistrationBean slrBean = new ServletListenerRegistrationBean (); slrBean.setListener (new SessionListener ()); return slrBean;}}
3, you can now deploy the program to start the server and open http:////monitoring in the browser. : for your host name + port address,: configure the address for your application. You should see the following interface:
3. Spring method-level monitoring
The premise is to use the monitoring-spring.xml file (without modification), and then use the @ MonitoredWithSpring annotation on the methods that need to be monitored.
Thank you for reading! This is the end of this article on "how to monitor the springboot project process based on javamelody". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!