pom.xml  如下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1..RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent> <groupId>com.ds</groupId>
<artifactId>ksh</artifactId>
<version>0.0.-SNAPSHOT</version>
<name>ksh</name>
<packaging>war</packaging>
<description>Demo project for Spring Boot</description> <properties>
<java.version>1.8</java.version>
</properties> <dependencies>
<!--web全栈开发-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!--使用外部tomcat需要把内置的tomcat排除-->
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency> <dependency>
<!--添加springboot-tomcat scope必须时 provided-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency> <!--测试 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> <!--使用freemarker必须包-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency> <!--java与mysql连接的jar包驱动程序-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.</version>
</dependency> <!-- mybatis-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency> <!-- jdbcTemplate -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency> <!-- redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> <!--json格式化-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.</version>
</dependency> </dependencies> <build>
<finalName>ksh_gis</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<!-- 分离配置文件-->
<!-- <resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/*.properties</exclude>
<exclude>**/*.yml</exclude>
</excludes>
</resource>
</resources>-->
</build> </project>

启动类

package com.ds.ksh.v1;

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; /*@SpringBootApplication
@MapperScan(basePackages = "com.ds")
public class KshApplication {
public static void main(String[] args) {
SpringApplication.run(KshApplication.class, args);
}
}*/
@SpringBootApplication
public class KshApplication extends SpringBootServletInitializer { public static void main(String[] args) {
SpringApplication.run(KshApplication.class, args);
} @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(KshApplication.class);
}
}

  tomcat部署   tomcat7使用以上版本不然有时候启动肯有问题

删除ROOT --> 将war复制到webapp下  -->  修改项目名字为ROOT.war

这样的好处是不用再配置别的东西直接启动就能访问

最新文章

  1. c# TimeSpan
  2. OpenCV整体的模块架构
  3. Python 的 pyinotify 模块 监控文件夹和文件的变动
  4. java反射机制一个例子
  5. WhatFontIs - 字体百科全书,没有不认识的字体
  6. 收藏的一段关于java大数运算的代码
  7. 完成OSS.Http底层HttpClient重构封装 支持标准库
  8. null == undefined ?
  9. gcc &amp; gdb &amp; make 定义与区别
  10. 使用gogs搭建git私有仓库
  11. es6的基本数据详解
  12. 如何将Drawable转为Bitmap?
  13. docker 学习(九) docker部署静态网站
  14. Tesseract-OCR 3.05 多过语言文字识别(运行程序+中英日韩语言包)
  15. emulator: ERROR: x86 emulation currently requires hardware acceleration!Please ensure Intel HAXM is properly installed and usable.CPU acceleration status: HAX kernel module is not installed!
  16. 2017 jq 总结
  17. 怎么成为asp.net大神!!!!!!!!!!!!!!!!!!!怎么成为asp.net大神!!!!!!!!!!!!!!!!!!!
  18. 关于linux系统如何实现fork的研究(二)【转】
  19. TF卡.之前的(20180923)
  20. [OpenJudge8471][划分DP]切割回文

热门文章

  1. pyinstaller打包总结
  2. java.lang.IllegalStateException: No output folder
  3. AIX中物理卷管理
  4. 【转】sysctl命令及改变net.ipv4.ip_forward = 1方法
  5. 安装CRMEasy步骤
  6. 模拟赛小结:2014-2015 ACM-ICPC, NEERC, Southern Subregional Contest
  7. Linux查看某进程的线程
  8. MyBatis主配置文件(转载)
  9. inotify.sh脚本范例
  10. 私有ip地址知多少?