问题
I am building Spring boot gradle application. I am trying to add an additional port for the actuator endpoint with Undertow.
Code: SecondActuatorPortConfiguration.java
package com.test.config;
import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.ManagementContextType;
import org.springframework.boot.web.embedded.undertow.UndertowBuilderCustomizer;
import org.springframework.context.annotation.Bean;
@ManagementContextConfiguration(ManagementContextType.CHILD)
public class SecondActuatorPortConfiguration {
@Bean
public UndertowBuilderCustomizer aa() {
return (undertow) -> {
// I need to expose 9090 (management.server.port=9090)
// and additional port, lets say - 9091
undertow.addHttpListener(9091, "0.0.0.0");
};
}
}
src/main/respurces/META-INF/spring.factories :
org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration=\
com.test.config.SecondActuatorPortConfiguration
Hierarchy of files: Hierarchy of files
Till now, all the changes have been made as per this.
But, if do netstat -tulpn | grep :9091
, then port is Listening but if I access this via http://127.0.0.1:9091/actuator
, then Error:
Whitelabel Error Page (type=Not Found, status=404) is coming
来源:https://stackoverflow.com/questions/62952159/whitelabel-error-coming-when-trying-to-integrate-managementcontextconfiguration