博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
springboot打war包部署到tomcat
阅读量:4609 次
发布时间:2019-06-09

本文共 1475 字,大约阅读时间需要 4 分钟。

1:build.gradle

plugins {    id 'org.springframework.boot' version '2.1.5.RELEASE'    id 'java'}apply plugin: 'io.spring.dependency-management'group = 'com.example'version = '0.0.1-SNAPSHOT'sourceCompatibility = '1.8'apply plugin: 'war'repositories {    mavenCentral()}dependencies {    implementation 'org.springframework.boot:spring-boot-starter-web'    testImplementation 'org.springframework.boot:spring-boot-starter-test'    compile group: 'com.google.code.gson', name: 'gson', version: '2.8.2'    providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')}

增加:

apply plugin: 'war'
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')

2:application.properties中增加

spring.jmx.enabled=false

3:入口程序继承SpringBootServletInitializer,覆写configure方法

package com.example.demo;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.boot.builder.SpringApplicationBuilder;import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;@SpringBootApplicationpublic class DemoApplication extends SpringBootServletInitializer {    @Override    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {        return application.sources(DemoApplication.class);    }    public static void main(String[] args) {        SpringApplication.run(DemoApplication.class, args);    }}

 

转载于:https://www.cnblogs.com/yshyee/p/10979065.html

你可能感兴趣的文章
事件对象
查看>>
ZOJ 3641 <并查集+STL>
查看>>
MongoDB 安装配置
查看>>
c++之引用和指针
查看>>
hdu 3560(dfs判环)
查看>>
hdu 3501(欧拉函数的应用)
查看>>
linux学习笔记(3):ubuntu使用超级管理员root登录
查看>>
Ubuntu 16.10 安装byzanz截取动态效果图工具
查看>>
网页前端页面加载性能测试各工具可行性方案分析
查看>>
Git入门篇
查看>>
Git强制推送命令
查看>>
HCL实验一
查看>>
数据结构之数组实现栈
查看>>
硬件——nrf51822第三篇,按键控制小灯
查看>>
拜师鸟哥之linux学习体会(7)——linux磁盘与文件系统管理
查看>>
编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第4章编程练习4
查看>>
鸡兔同笼问题
查看>>
JavaScript总结
查看>>
钢笔工具路径描边技巧 课时1:8选区路径之间的转换
查看>>
程序员的十层楼
查看>>