idea怎么使用外置tomcat配置springboot 您所在的位置:网站首页 idea创建springboot不会下载依赖 idea怎么使用外置tomcat配置springboot

idea怎么使用外置tomcat配置springboot

2023-05-13 03:42| 来源: 网络整理| 查看: 265

创建一个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 登录后复制

idea怎么使用外置tomcat配置springboot

idea怎么使用外置tomcat配置springboot

完成下图操作保存即可

idea怎么使用外置tomcat配置springboot

配置tomcat启动项

idea怎么使用外置tomcat配置springboot

idea怎么使用外置tomcat配置springboot

idea怎么使用外置tomcat配置springboot

idea怎么使用外置tomcat配置springboot

配置视图解析器

idea怎么使用外置tomcat配置springboot

创建一个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就启动成功了

idea怎么使用外置tomcat配置springboot

以上就是idea怎么使用外置tomcat配置springboot的详细内容,更多请关注php中文网其它相关文章!



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有