Spring Boot - how to configure port


Update via a properties file.

/src/main/resources/application.properties

server.port=8888

Update via a yaml file.

server:
  port:8888

EmbeddedServletContainerCustomizer


@Component
public class CustomContainer implements EmbeddedServletContainerCustomizer {

    @Override
    public void customize(ConfigurableEmbeddedServletContainer container) {

        container.setPort(8888);

    }

}

Post a Comment

Previous Post Next Post