在Spring Boot2.0以上配置嵌入式Servlet容器時EmbeddedServletContainerCustomizer類不存在,經網絡查詢發現被WebServerFactoryCustomizer替代
操作示例如下:

代碼:
@Bean public WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer() { return new WebServerFactoryCustomizer<ConfigurableWebServerFactory>() { @Override public void customize(ConfigurableWebServerFactory factory) { factory.setPort(8000); } }; }
Spring Boot2.0以下版本:(目前沒有自身測試過:2.0以下版本請優先作為參考)
@Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return (container -> {container.setPort(1234);}); }
Face your past without regret. Handle your present with confidence.Prepare for future without fear. keep the faith and drop the fear.
面對過去無怨無悔,把握現在充滿信心,備戰未來無所畏懼。保持信念,克服恐懼!一點一滴的積累,一點一滴的沉淀,學技術需要不斷的積淀!
