0
点赞
收藏
分享

微信扫一扫

Spring Boot 2.0 内嵌 Tomcat 定制 : WebServerFactoryCustomizer

ixiaoyang8 2022-06-10 阅读 85

Spring Boot 2.0 内嵌 Tomcat 定制 : WebServerFactoryCustomizer

在 Spring Boot 1.x 中 ,我们通过 EmbeddedServletContainerCustomizer 接口调优 Tomcat 自定义配置。 在Spring Boot 2.0 中,通过 WebServerFactoryCustomizer 接口定制。

As far as the port is concerned, I'd use the configuration option as already answered.

However, you can still use a customizer, however, the types and location will change in Spring Boot 2.0, see:

import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.stereotype.Component;

@Component
public class CustomizationBean implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {

@Override
public void customize(ConfigurableServletWebServerFactory server) {
server.setPort(9000);
}

}

​​https://stackoverflow.com/questions/43571505/how-to-find-the-interface-embeddedservletcontainercustomizer-in-spring-boot-2-0​​



举报

相关推荐

0 条评论