Whitelabel Error coming when trying to integrate @ManagementContextConfiguration in META-INF/spring.factories

纵然是瞬间 提交于 2020-07-23 06:42:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!