I have Spring Boot web application. It exposes REST API on port 8080. It also exposes management port 8081 with Spring Boot Management endpoints (http://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-monitoring.html).
I do not have any custom Tomcat configuration to achieve that. I just have property management.port=8081
in my application.properties
file.
I have JavaMelody configured as described in
https://github.com/javamelody/javamelody/wiki/UserGuideAdvanced#spring-boot-app
(I have my custom JavaMelodyConfiguration
class, with org.springframework.boot.web.servlet.FilterRegistrationBean
that registers net.bull.javamelody.MonitoringFilter
).
@Bean
public FilterRegistrationBean javaMelody() {
final FilterRegistrationBean javaMelody = new FilterRegistrationBean();
javaMelody.setFilter(new MonitoringFilter());
javaMelody.setAsyncSupported(true);
javaMelody.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC);
javaMelody.addUrlPatterns("/*");
return javaMelody;
}
With this configuration, Javamelody is exposed on port 8080 (business port). I would like to move it to 8081(management port). How to change that?
I use Spring Boot 1.4.2.RELEASE, javamelody 1.62.0
If the goal is to expose monitoring on management port starting from java melody version 1.76 is now much simpler.
You need Spring Boot 2.x, actuator and in yml or properties file:
See more details here: https://github.com/javamelody/javamelody/wiki/SpringBootStarter#configuration-in-case-of-management-port