How to remove default http-listener on spring boot embedded undertow

19 Views Asked by At

I am adding https-listener to the webserver with a customize method as below.When starting the webserver, it adds http-listener with port 8080 by default.How can I prevent it from adding http-listener?

  @Bean
    public WebServerFactoryCustomizer<UndertowServletWebServerFactory> containerCustomizer() {
        return (WebServerFactoryCustomizer) factory -> {
            UndertowServletWebServerFactory undertowFactory = (UndertowServletWebServerFactory) factory;
            undertowFactory.addDeploymentInfoCustomizers(new ContextSecurityCustomizer());

            undertowFactory.getBuilderCustomizers().add(builder -> {
                try {
                    builder.addHttpsListener(serverPort, httpInterface, getSSLContext());
                    builder.setServerOption(UndertowOptions.ENABLE_HTTP2,true);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            });

        };
    }

0

There are 0 best solutions below