Update via a properties file.
/src/main/resources/application.propertiesserver.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);
}
}