SpringBoot默认使用嵌入式的Servlet容器,应用打包成可执行的jar包

优点:简单、便携

缺点:默认不支持jsp,优化定制比较复杂(使用定制器serverProperties、自定义EmbeddedServletContainerCustomizer,自己编写嵌入式Servlet容器的创建工厂EmbeddedServletContainerFactory)

*SpringBoot使用外置的Servlet容器条件

  1.安装外置Servlet容器【tomcat】

  2.使用war方式进行打包

(1)、使用Spring初始化向导创建war  SpringBoot项目

(2)在Project Structure窗口创建目录结构

(3)在运行窗口配置外置Tomcat

(4)修改配置文件

(5)将嵌入式的Tomcat指定为provided

(6)编写一个SpringBootServletInitializer的子类,并调用configure方法

 package cn.coreqi;

 import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; /**
* 必须编写一个SpringBootServletInitializer的子类,并调用configure方法
*/
public class ServletInitializer extends SpringBootServletInitializer { @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//传入SpringBoot应用的主程序
return application.sources(SpringbootwarApplication.class);
} }

(7)编写控制器、jsp页面后点击tomcat运行即可

最新文章

  1. SpringMVC学习系列(9) 之 实现注解式权限验证
  2. 粒子群优化算法(Particle Swarm Optimization)
  3. nodejs快速入门
  4. html-----012---颜色的改变
  5. Eclipse中使用git把项目导入到osc@git中
  6. AJAX 控件集之TextBoxWatermark(水印文本框)控件
  7. [Day03] 循环语句、list相关练习题
  8. git学习之创建版本库
  9. css盒子居中定位问题
  10. upstream timed out (110: Connection timed out) while reading response header from upstream, client:
  11. weakhashmap简单理解
  12. h3c acl配置一列
  13. MySQL基础配置之mysql的默认字符编码的设置(my.ini设置字符编码) - 转载
  14. C# Azure 远程调试
  15. iOS视频流开发(2)—视频播放
  16. 学JS的心路历程 - PixiJS -基础(一)
  17. 【转】H.264 SVC
  18. 10BASE
  19. Modbus Com SerialPort
  20. jQuery--修改表单数据并提交

热门文章

  1. 【POI每日题解 #5】 DWU-Double-row
  2. SharePoint 2013 pre-config
  3. suoi37 清点更多船只 (卡空间线段树)
  4. WEB入门之十三 jQuery选择器
  5. Android Selector 与 Shape 基本用法
  6. BSGS
  7. Python数据挖掘课程
  8. 使用gdb+core查看错误信息
  9. vue2.0 keep-alive最佳实践
  10. (母函数 Catalan数 大数乘法 大数除法) Train Problem II hdu1023