前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Spring Boot 2.0 内嵌 Tomcat 定制 : WebServerFactoryCustomizer

Spring Boot 2.0 内嵌 Tomcat 定制 : WebServerFactoryCustomizer

作者头像
一个会写诗的程序员
发布2018-08-17 11:11:19
1.5K0
发布2018-08-17 11:11:19
举报

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> {

代码语言:javascript
复制
@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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018.01.27 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档