1,修改pom.xml文件
将jar包改成war包
<!--<packaging>jar</packaging>-->
<packaging>war</packaging>
2,添加Spring Boot 的tomcat依赖
<!--添加tomcat-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
3,添加Servlet依赖,只在编译时有效
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
4,实现SpringBootServletInitializer,重写configure()方法
@SpringBootApplication
@MapperScan("com.zhang.springbootmybatisdemo.dao")
public class SpringbootMybatisDemoApplication extends SpringBootServletInitializer {
SpringBoot jar改war
最新推荐文章于 2024-03-08 10:34:13 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)