如何在SpringBoot中内嵌Tomcat并启动-创新互联
本篇文章给大家分享的是有关如何在Spring Boot中内嵌Tomcat并启动,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

createEmbeddedServletContainer创建了内嵌的Servlet容器,我用的是默认的Tomcat。
private void createEmbeddedServletContainer() {
EmbeddedServletContainer localContainer = this.embeddedServletContainer;
ServletContext localServletContext = getServletContext();
if (localContainer == null && localServletContext == null) {
EmbeddedServletContainerFactory containerFactory = getEmbeddedServletContainerFactory();
this.embeddedServletContainer = containerFactory
.getEmbeddedServletContainer(getSelfInitializer());
}
else if (localServletContext != null) {
try {
getSelfInitializer().onStartup(localServletContext);
}
catch (ServletException ex) {
throw new ApplicationContextException("Cannot initialize servlet context",
ex);
}
}
initPropertySources();
} 当前标题:如何在SpringBoot中内嵌Tomcat并启动-创新互联
标题来源:http://www.jxjierui.cn/article/coidjg.html


咨询
建站咨询
