idea怎么使用外置tomcat配置springboot
作者:小月亮
时间:2023-05-11
来源:正软商城
浏览:2
创建一个maven项目导入springboot依赖,注意底下注释部分4.0.0com.znsd.springbootspringboot-jsp1.0-SNAPSHOTwarorg.springframework.bootspring-boot-starter-parent2.3.12.RELEASEorg.springframework.bootspring-boot-starter-weborg.springframework.bootspring-boot-starter-tomcatprovide
本文目录
创建一个maven项目
导入springboot依赖,注意底下注释部分
4.0.0 com.znsd.springboot springboot-jsp 1.0-SNAPSHOT war org.springframework.boot spring-boot-starter-parent 2.3.12.RELEASE org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat provided org.springframework.boot spring-boot-starter-test test org.junit.vintage junit-vintage-engine org.springframework.boot spring-boot-maven-plugin


完成下图操作保存即可

配置tomcat启动项




配置视图解析器

创建一个springboot主程序
@SpringBootApplication
public class SpringBootMain {
public static void main(String[] args) {
SpringApplication.run(SpringBootMain.class,args);
}
}必须编写一个SpringBootServletInitializer的子类,并调用configure方法里面的固定写法
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//传入SpringBoot的主程序,
return application.sources(SpringBootMain.class);
}
}然后启动tomcat,控制台输出了spring就启动成功了

作者最新文章
wps如何生成目录自动生成目录
2026-11-05 11:16
二狗PPT怎么用Word文档生成PPT
2026-11-03 14:55
office打开弹出另存为 修复保存设置
2026-11-03 10:08
火山引擎EMRAI助手导出诊断结果方法
2026-11-01 19:35
navicat连接mysql数据库 配置测试方法
2026-10-26 10:02
热门文章
更多
精品专题
更多
Mac软件
更多
火山引擎 网页版
Windows/ macOS/ Linux
火山引擎是字节跳动旗下企业级云与AI服务平台。聚焦大模型核心能力,依托字节自研豆包多模态大模型,凭借火山方舟一站式平台,提供模型精调、推理部署、智能应用搭建等全链路服务,结合高性能AI算力,助力各行业快速落地大模型数字化与智能化应用。
















