spring-boot|spring-boot war包启动方式(发布到web容器的demo)
今天学习了springboot 发布war包到web容器,如tomcat jetty等的学习,做个备忘.
启动类:
package com.cowoby.springbootedu; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; /** * WAR包的启动方式 */ @SpringBootApplication public class SpringBootEduApplicationWar extends SpringBootServletInitializer{public static void main(String[] args) { SpringApplication.run(SpringBootEduApplicationWar.class, args); } @RestController public static class MyController{ @RequestMapping("/hello") @ResponseBody public String hello(){ System.out.println("hello spring boot..."); return "hello spring boot..."; } } }
【spring-boot|spring-boot war包启动方式(发布到web容器的demo)】
pom.xml
4.0.0 com.cowoby spring-boot-edu 0.0.1-SNAPSHOT warspring-boot-edu Demo project for Spring Boot. 此配置是使用war包的启动方式 UTF-8 UTF-81.8 org.springframework.boot spring-boot-dependencies 1.5.6.RELEASE pom import org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat org.springframework.boot spring-boot-starter-tomcat provided org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-maven-plugin org.apache.maven.plugins maven-war-plugin false
推荐阅读
- VM|VM ware 的 harbor 私有仓库搭建 (Ubuntu16.04)
- 联邦学习|【阅读笔记】Towards Efficient and Privacy-preserving Federated Deep Learning
- 废材自救记录|虚拟机-无法安装vmware tools的解决方法
- jar|springboot项目打成jar包和war包,并部署(快速打包部署)
- WARN|WARN [launcher]: PhantomJS have not captured in 60000 ms, killing
- Android|Android 清单文件的硬件加速android:hardwareAccelerated 慎重
- java--jar包启动命令(配置分离模式)
- Spring|Spring Boot parent 或者 spring-boot-dependencies引入spring boot
- 跟着白泽读paper丨kAFL:|跟着白泽读paper丨kAFL: Hardware-Assisted Feedback Fuzzing for OS Kernels
- 从《Software|从《Software Engineer at Google》学 CodeReview