diff --git a/README.md b/README.md
index 655a1c1..e967f98 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Spring Boot Demo
-spring boot demo 是一个用来学习 spring boot 的项目,已经集成 actuator(监控)、admin(可视化监控)、logback(日志)、aopLog(通过 AOP 记录 web 请求日志)、统一异常处理( json 级别和页面级别)、freemarker(模板引擎)、thymeleaf(模板引擎)、JPA(ORM 框架)、mybatis(ORM 框架)、redis-cache(缓存)、swagger(API 接口管理测试)、ureport2(中国式报表)模块,后续会集成activemq,email,shiro,websocket,quartz,netty等模块。
+spring boot demo 是一个用来学习 spring boot 的项目,已经集成 actuator(监控)、admin(可视化监控)、logback(日志)、aopLog(通过 AOP 记录 web 请求日志)、统一异常处理( json 级别和页面级别)、freemarker(模板引擎)、thymeleaf(模板引擎)、JPA(ORM 框架)、mybatis(ORM 框架)、redis-cache(缓存)、swagger(API 接口管理测试)、ureport2(中国式报表)、打包成 war 文件,后续会集成activemq,email,shiro,websocket,quartz,netty等模块。
依赖的 Spring Boot 版本:
@@ -59,6 +59,7 @@ spring boot demo 是一个用来学习 spring boot 的项目,已经集成 actu
../spring-boot-demo-cache-redis
../spring-boot-demo-swagger
../spring-boot-demo-ureport2
+ ../spring-boot-demo-war
@@ -159,6 +160,7 @@ spring boot demo 是一个用来学习 spring boot 的项目,已经集成 actu
| [spring-boot-demo-cache-redis](./spring-boot-demo-cache-redis) | spring-boot 使用 Redis 做缓存 |
| [spring-boot-demo-swagger](./spring-boot-demo-swagger) | spring-boot 集成 [spring-boot-starter-swagger](https://github.com/SpringForAll/spring-boot-starter-swagger) (由大佬[翟永超](http://blog.didispace.com/)开源)用于统一管理、测试 API 接口 |
| [spring-boot-demo-ureport2](./spring-boot-demo-ureport2) | spring-boot 集成 [ureport2](https://github.com/youseries/ureport) 实现自定义报表(ureport2可以轻松实现复杂的中国式报表,功能十分强大) |
+| [spring-boot-demo-war](./spring-boot-demo-war) | spring-boot 打成 war 包的配置 |
# 官方提供的 starter 介绍
diff --git a/TODO.md b/TODO.md
index b5d2542..e946b36 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,6 +1,6 @@
# spring-boot-demo 项目
-## 模块计划(已完成:14 / 37)
+## 模块计划(已完成:15 / 37)
- [x] ~~spring-boot-demo-helloworld(Helloworld 示例)~~
- [x] ~~spring-boot-demo-properties(读取配置文件信息)~~
@@ -38,7 +38,7 @@
- [ ] spring-boot-demo-activiti(集成 Activiti 实现流程控制引擎)
- [ ] spring-boot-demo-async(Spring boot 实现异步调用)
- [ ] spring-boot-demo-dubbo(集成 dubbo)
-- [ ] spring-boot-demo-war(打包成war包)
+- [x] ~~spring-boot-demo-war(打包成war包)~~
### 备注
diff --git a/spring-boot-demo-parent/pom.xml b/spring-boot-demo-parent/pom.xml
index 807aae0..e4a4268 100644
--- a/spring-boot-demo-parent/pom.xml
+++ b/spring-boot-demo-parent/pom.xml
@@ -26,6 +26,7 @@
../spring-boot-demo-cache-redis
../spring-boot-demo-swagger
../spring-boot-demo-ureport2
+ ../spring-boot-demo-war
diff --git a/spring-boot-demo-war/README.md b/spring-boot-demo-war/README.md
new file mode 100644
index 0000000..001e0c1
--- /dev/null
+++ b/spring-boot-demo-war/README.md
@@ -0,0 +1,67 @@
+# spring-boot-demo-war
+
+依赖[spring-boot-demo-parent](../spring-boot-demo-parent)、`spring-boot-starter-tomcat`
+
+### pom.xml
+
+```xml
+
+
+ 4.0.0
+
+ spring-boot-demo-war
+ 0.0.1-SNAPSHOT
+
+ war
+
+ spring-boot-demo-war
+ Demo project for Spring Boot
+
+
+ com.xkcoding
+ spring-boot-demo-parent
+ 0.0.1-SNAPSHOT
+ ../spring-boot-demo-parent/pom.xml
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+
+
+ spring-boot-demo-war
+
+
+
+```
+
+### ServletInitializer.java
+
+```java
+/**
+ * 新建一个 ServletInitializer 类,继承 SpringBootServletInitializer
+ * 打成 war 包修改的第 ③ 处
+ * @package: com.xkcoding.springbootdemowar
+ * @description: 新建一个 ServletInitializer 类,继承 SpringBootServletInitializer
+ * @author: yangkai.shen
+ * @date: Created in 2017/11/30 下午1:26
+ * @copyright: Copyright (c) 2017
+ * @version: 0.0.1
+ * @modified: yangkai.shen
+ */
+public class ServletInitializer extends SpringBootServletInitializer {
+
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+ return application.sources(SpringBootDemoWarApplication.class);
+ }
+
+}
+```
\ No newline at end of file
diff --git a/spring-boot-demo-war/pom.xml b/spring-boot-demo-war/pom.xml
new file mode 100644
index 0000000..3fd916e
--- /dev/null
+++ b/spring-boot-demo-war/pom.xml
@@ -0,0 +1,35 @@
+
+
+ 4.0.0
+
+ spring-boot-demo-war
+ 0.0.1-SNAPSHOT
+
+ war
+
+ spring-boot-demo-war
+ Demo project for Spring Boot
+
+
+ com.xkcoding
+ spring-boot-demo-parent
+ 0.0.1-SNAPSHOT
+ ../spring-boot-demo-parent/pom.xml
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+ provided
+
+
+
+
+ spring-boot-demo-war
+
+
+
\ No newline at end of file
diff --git a/spring-boot-demo-war/src/main/java/com/xkcoding/springbootdemowar/ServletInitializer.java b/spring-boot-demo-war/src/main/java/com/xkcoding/springbootdemowar/ServletInitializer.java
new file mode 100644
index 0000000..c8dd840
--- /dev/null
+++ b/spring-boot-demo-war/src/main/java/com/xkcoding/springbootdemowar/ServletInitializer.java
@@ -0,0 +1,24 @@
+package com.xkcoding.springbootdemowar;
+
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.support.SpringBootServletInitializer;
+
+/**
+ * 新建一个 ServletInitializer 类,继承 SpringBootServletInitializer
+ * 打成 war 包修改的第 ③ 处
+ * @package: com.xkcoding.springbootdemowar
+ * @description: 新建一个 ServletInitializer 类,继承 SpringBootServletInitializer
+ * @author: yangkai.shen
+ * @date: Created in 2017/11/30 下午1:26
+ * @copyright: Copyright (c) 2017
+ * @version: 0.0.1
+ * @modified: yangkai.shen
+ */
+public class ServletInitializer extends SpringBootServletInitializer {
+
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+ return application.sources(SpringBootDemoWarApplication.class);
+ }
+
+}
diff --git a/spring-boot-demo-war/src/main/java/com/xkcoding/springbootdemowar/SpringBootDemoWarApplication.java b/spring-boot-demo-war/src/main/java/com/xkcoding/springbootdemowar/SpringBootDemoWarApplication.java
new file mode 100644
index 0000000..8d51f05
--- /dev/null
+++ b/spring-boot-demo-war/src/main/java/com/xkcoding/springbootdemowar/SpringBootDemoWarApplication.java
@@ -0,0 +1,12 @@
+package com.xkcoding.springbootdemowar;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SpringBootDemoWarApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringBootDemoWarApplication.class, args);
+ }
+}
diff --git a/spring-boot-demo-war/src/main/resources/application.yml b/spring-boot-demo-war/src/main/resources/application.yml
new file mode 100644
index 0000000..3cae10b
--- /dev/null
+++ b/spring-boot-demo-war/src/main/resources/application.yml
@@ -0,0 +1,3 @@
+server:
+ port: 8080
+ context-path: /demo
\ No newline at end of file
diff --git a/spring-boot-demo-war/src/test/java/com/xkcoding/springbootdemowar/SpringBootDemoWarApplicationTests.java b/spring-boot-demo-war/src/test/java/com/xkcoding/springbootdemowar/SpringBootDemoWarApplicationTests.java
new file mode 100644
index 0000000..8c0fec2
--- /dev/null
+++ b/spring-boot-demo-war/src/test/java/com/xkcoding/springbootdemowar/SpringBootDemoWarApplicationTests.java
@@ -0,0 +1,16 @@
+package com.xkcoding.springbootdemowar;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class SpringBootDemoWarApplicationTests {
+
+ @Test
+ public void contextLoads() {
+ }
+
+}