How do I configure the TCP/IP port listened on by a Spring Boot application, so it does not use the default port of 8080.
1.1 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);
}
}