SpringBoot打包成war包

Easter79
• 阅读 802

1、添加依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

2、添加插件

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
</plugin>

3、指定打包后的文件名

<finalName>${project.artifactId}</finalName>

注:放在

4、Application.java继承

org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

后重写configure方法

protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(MiaoshaApplication.class);
}

5、修改

jar

war

点赞
收藏
评论区
推荐文章
Easter79 Easter79
3年前
spring集成kafka
1、引入依赖jar包<dependency<groupIdorg.springframework.kafka</groupId<artifactIdspringkafka</artifactId</dependency2、配置kafka信息
Easter79 Easter79
3年前
Springboot简单集成ActiveMQ
Springboot简单集成ActiveMQ消息发送者的实现pom.xml添加依赖<dependency<groupIdorg.springframework.boot</groupId<artifactIdspringbootstarteractivemq</artifactId</dependency<d
Stella981 Stella981
3年前
SpringBoot持久层技术
一、Springboot整合mybatismaven中添加对数据库与mybatis的依赖1<dependencies2<dependency3<groupIdorg.springframework.boot</groupId4<artifactId
Stella981 Stella981
3年前
Spring boot 的腾讯企业邮箱发送 实例
1\.引入springbootstartermail依赖包<!支持发送邮件<dependency<groupIdorg.springframework.boot</groupId<artifactIdspringbootstartermail</artifactId
Stella981 Stella981
3年前
ElasticSearch Java API 增删改查操作
1.添加pom.xml依赖<dependency<groupIdjunit</groupId<artifactIdjunit</artifactId<version4.11</version<scopetest</scope</dependency<dependency<groupI
Stella981 Stella981
3年前
SpringBoot集成Spring Security(授权与认证)
⒈添加starter依赖1<dependency2<groupIdorg.springframework.boot</groupId3<artifactIdspringbootstarterweb</artifactId4
Stella981 Stella981
3年前
SpringBoot2.0使用health
1,引入actuator<dependency<groupIdorg.springframework.boot</groupId<artifactIdspringbootstarteractuator</artifactId</dependency2,application.prop
Stella981 Stella981
3年前
SpringBoot打包成war包
1、添加依赖<dependency<groupIdorg.springframework.boot</groupId<artifactIdspringbootstartertomcat</artifactId<scopeprovided</scope</dependency2
Easter79 Easter79
3年前
SpringBoot2.0使用health
1,引入actuator<dependency<groupIdorg.springframework.boot</groupId<artifactIdspringbootstarteractuator</artifactId</dependency2,application.prop
Easter79 Easter79
3年前
SpringBoot集成Spring Security(授权与认证)
⒈添加starter依赖1<dependency2<groupIdorg.springframework.boot</groupId3<artifactIdspringbootstarterweb</artifactId4
Easter79
Easter79
Lv1
今生可爱与温柔,每一样都不能少。
文章
2.8k
粉丝
5
获赞
1.2k