美文网首页springboot
springboot 启动tomcat流程

springboot 启动tomcat流程

作者: zh_89 | 来源:发表于2019-10-21 15:28 被阅读0次
springboot-tomcat

注意第10步初始化嵌入式Tomcat

@Override

public WebServergetWebServer(ServletContextInitializer... initializers) {

  Tomcat tomcat =new Tomcat();

  File baseDir =(this.baseDirectory !=null) ?this.baseDirectory : createTempDir("tomcat");

  tomcat.setBaseDir(baseDir.getAbsolutePath());

  Connector connector =new Connector(this.protocol);

  tomcat.getService().addConnector(connector);

  customizeConnector(connector);

  tomcat.setConnector(connector);

  tomcat.getHost().setAutoDeploy(false);

  configureEngine(tomcat.getEngine());

  for (Connector additionalConnector :this.additionalTomcatConnectors) {

      tomcat.getService().addConnector(additionalConnector);

  }

  prepareContext(tomcat.getHost(), initializers);

  return getTomcatWebServer(tomcat);

}

相关文章

网友评论

    本文标题:springboot 启动tomcat流程

    本文链接:https://www.haomeiwen.com/subject/ajmtvctx.html