You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 14 kB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. # Spring Boot Demo
  2. [![MIT](https://img.shields.io/github/license/xkcoding/spring-boot-demo.svg)](https://github.com/xkcoding/spring-boot-demo/blob/master/LICENSE) [![GitHub stars](https://img.shields.io/github/stars/xkcoding/spring-boot-demo.svg?style=flat&label=Star)](https://github.com/xkcoding/spring-boot-demo/stargazers) [![GitHub forks](https://img.shields.io/github/forks/xkcoding/spring-boot-demo.svg?style=flat&label=Fork)](https://github.com/xkcoding/spring-boot-demo/fork) [![GitHub watchers](https://img.shields.io/github/watchers/xkcoding/spring-boot-demo.svg?style=flat&label=Watch)](https://github.com/xkcoding/spring-boot-demo/watchers)
  3. spring boot demo 是一个用来学习 spring boot 的项目,已经集成 actuator (监控)、admin (可视化监控)、logback (日志)、aopLog (通过 AOP 记录 web 请求日志)、统一异常处理( json 级别和页面级别)、freemarker (模板引擎)、thymeleaf (模板引擎)、Beetl (模板引擎)、JdbcTemplate、JPA (ORM 框架)、mybatis (ORM 框架)、redis-cache (缓存)、task (定时任务)、swagger (API 接口管理测试)、ureport2 (中国式报表)、打包成 war 文件、集成 ElasticSearch (采用原生操作 ES 的方式)、集成 Dubbo (采用非官方的 starter),后续会集成activemq,email,shiro,websocket,quartz,netty等模块。
  4. 依赖的 Spring Boot 版本:
  5. ```xml
  6. <parent>
  7. <groupId>org.springframework.boot</groupId>
  8. <artifactId>spring-boot-starter-parent</artifactId>
  9. <version>1.5.8.RELEASE</version>
  10. <relativePath/> <!-- lookup parent from repository -->
  11. </parent>
  12. ```
  13. ### 开发环境
  14. - **JDK1.8 +**
  15. - **Maven 3.5 +**
  16. - **IntelliJ IDEA ULTIMATE 2017.2 +**
  17. - **mysql 5.7 +** (*尽量5.7版本以上,因为5.7版本加了一些新特性,不向下兼容。本demo里会尽量避免这种不兼容的地方,但还是建议尽量保证5.7版本以上*)
  18. ### 开发计划
  19. [**进度计划**](https://github.com/xkcoding/spring-boot-demo/projects/1?fullscreen=true) 或直接查看 [TODO](./TODO.md)
  20. ### spring-boot-demo-parent
  21. 除了 **Dubbo** 的 demo 以外,所有的 **Module** 均依赖:[**spring-boot-demo-parent**](./spring-boot-demo-parent)
  22. ### pom.xml
  23. ```xml
  24. <?xml version="1.0" encoding="UTF-8"?>
  25. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  26. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  27. <modelVersion>4.0.0</modelVersion>
  28. <groupId>com.xkcoding</groupId>
  29. <artifactId>spring-boot-demo-parent</artifactId>
  30. <version>0.0.1-SNAPSHOT</version>
  31. <packaging>pom</packaging>
  32. <name>spring-boot-demo-parent</name>
  33. <description>The parent of spring-boot-demo</description>
  34. <modules>
  35. <module>../spring-boot-demo-helloworld</module>
  36. <module>../spring-boot-demo-properties</module>
  37. <module>../spring-boot-demo-actuator</module>
  38. <module>../spring-boot-demo-admin</module>
  39. <module>../spring-boot-demo-logback</module>
  40. <module>../spring-boot-demo-aoplog</module>
  41. <module>../spring-boot-demo-exceptionhandler</module>
  42. <module>../spring-boot-demo-template-freemarker</module>
  43. <module>../spring-boot-demo-template-thymeleaf</module>
  44. <module>../spring-boot-demo-orm-jpa</module>
  45. <module>../spring-boot-demo-orm-mybatis</module>
  46. <module>../spring-boot-demo-cache-redis</module>
  47. <module>../spring-boot-demo-swagger</module>
  48. <module>../spring-boot-demo-rabc-shiro-mybatis</module>
  49. <module>../spring-boot-demo-ureport2</module>
  50. <module>../spring-boot-demo-war</module>
  51. <module>../spring-boot-demo-util</module>
  52. <module>../spring-boot-demo-elasticsearch</module>
  53. <module>../spring-boot-demo-template-beetl</module>
  54. <module>../spring-boot-demo-task-schedule</module>
  55. <module>../spring-boot-demo-orm-jdbctemplate</module>
  56. </modules>
  57. <parent>
  58. <groupId>org.springframework.boot</groupId>
  59. <artifactId>spring-boot-starter-parent</artifactId>
  60. <version>1.5.8.RELEASE</version>
  61. <relativePath/> <!-- lookup parent from repository -->
  62. </parent>
  63. <properties>
  64. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  65. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  66. <java.version>1.8</java.version>
  67. <hutool.version>3.2.0</hutool.version>
  68. <commons.lang3.version>3.5</commons.lang3.version>
  69. <commons.collections.version>3.2.2</commons.collections.version>
  70. <commons.codec.version>1.10</commons.codec.version>
  71. </properties>
  72. <dependencies>
  73. <dependency>
  74. <groupId>org.springframework.boot</groupId>
  75. <artifactId>spring-boot-starter</artifactId>
  76. </dependency>
  77. <dependency>
  78. <groupId>org.springframework.boot</groupId>
  79. <artifactId>spring-boot-starter-web</artifactId>
  80. </dependency>
  81. <dependency>
  82. <groupId>org.springframework.boot</groupId>
  83. <artifactId>spring-boot-starter-test</artifactId>
  84. <scope>test</scope>
  85. </dependency>
  86. <!--DB-->
  87. <dependency>
  88. <groupId>mysql</groupId>
  89. <artifactId>mysql-connector-java</artifactId>
  90. </dependency>
  91. <!--工具类-->
  92. <dependency>
  93. <groupId>org.apache.commons</groupId>
  94. <artifactId>commons-lang3</artifactId>
  95. <version>${commons.lang3.version}</version>
  96. </dependency>
  97. <dependency>
  98. <groupId>commons-collections</groupId>
  99. <artifactId>commons-collections</artifactId>
  100. <version>${commons.collections.version}</version>
  101. </dependency>
  102. <dependency>
  103. <groupId>commons-codec</groupId>
  104. <artifactId>commons-codec</artifactId>
  105. <version>${commons.codec.version}</version>
  106. </dependency>
  107. <dependency>
  108. <groupId>com.xiaoleilu</groupId>
  109. <artifactId>hutool-all</artifactId>
  110. <version>${hutool.version}</version>
  111. </dependency>
  112. <dependency>
  113. <groupId>com.google.guava</groupId>
  114. <artifactId>guava</artifactId>
  115. <version>23.0</version>
  116. </dependency>
  117. <dependency>
  118. <groupId>org.projectlombok</groupId>
  119. <artifactId>lombok</artifactId>
  120. </dependency>
  121. </dependencies>
  122. <build>
  123. <plugins>
  124. <plugin>
  125. <groupId>org.springframework.boot</groupId>
  126. <artifactId>spring-boot-maven-plugin</artifactId>
  127. </plugin>
  128. </plugins>
  129. </build>
  130. </project>
  131. ```
  132. ### 各 Module 介绍
  133. | Module 名称 | Module 介绍 |
  134. | ------------------------------------------------------------ | ------------------------------------------------------------ |
  135. | [spring-boot-demo-helloworld](./spring-boot-demo-helloworld) | spring-boot 的一个 helloworld |
  136. | [spring-boot-demo-properties](./spring-boot-demo-properties) | spring-boot 读取配置文件中的内容 |
  137. | [spring-boot-demo-actuator](./spring-boot-demo-actuator) | spring-boot 集成 spring-boot-starter-actuator 用于监控 spring-boot 的启动和运行状态 |
  138. | [spring-boot-demo-admin](./spring-boot-demo-admin) | spring-boot 集成 spring-boot-admin 来可视化的监控 spring-boot 程序的运行状态,可以与 actuator 互相搭配使用 |
  139. | [spring-boot-demo-logback](./spring-boot-demo-logback) | spring-boot 集成 logback 日志 |
  140. | [spring-boot-demo-aoplog](./spring-boot-demo-aoplog) | spring-boot 使用 AOP 切面的方式记录 web 请求日志 |
  141. | [spring-boot-demo-exceptionhandler](./spring-boot-demo-exceptionhandler) | spring-boot 统一异常处理,包括2种,一种返回统一的 json 格式,第二种统一跳转到异常页面 |
  142. | [spring-boot-demo-template-freemarker](./spring-boot-demo-template-freemarker) | spring-boot 集成 freemarker 模板引擎 |
  143. | [spring-boot-demo-template-thymeleaf](./spring-boot-demo-template-thymeleaf) | spring-boot 集成 thymeleaf 模板引擎 |
  144. | [spring-boot-demo-template-beetl](./spring-boot-demo-template-beetl) | spring-boot 集成 Beetl 模板引擎 |
  145. | [spring-boot-demo-orm-jpa](./spring-boot-demo-orm-jpa) | spring-boot 集成 spring-boot-starter-data-jpa 操作数据库 |
  146. | [spring-boot-demo-orm-mybatis](./spring-boot-demo-orm-mybatis) | spring-boot 集成 [mybatis-spring-boot-starter](https://github.com/mybatis/spring-boot-starter)、[mybatis-spring-boot-starter](https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter) |
  147. | [spring-boot-demo-cache-redis](./spring-boot-demo-cache-redis) | spring-boot 使用 Redis 做缓存 |
  148. | [spring-boot-demo-task-schedule](./spring-boot-demo-task-schedule) | spring-boot 使用 @Scheduled 实现定时任务 |
  149. | [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 接口 |
  150. | [spring-boot-demo-ureport2](./spring-boot-demo-ureport2) | spring-boot 集成 [ureport2](https://github.com/youseries/ureport) 实现自定义报表(ureport2可以轻松实现复杂的中国式报表,功能十分强大) |
  151. | [spring-boot-demo-war](./spring-boot-demo-war) | spring-boot 打成 war 包的配置 |
  152. | [spring-boot-demo-elasticsearch](./spring-boot-demo-elasticsearch) | spring-boot 集成 ElasticSearch(采用原生操作 ES 的方式) |
  153. | [spring-boot-demo-dubbo-parent](./spring-boot-demo-dubbo-parent) | spring-boot 集成 Dubbo |
  154. # 官方提供的 starter 介绍
  155. | Name | Description |
  156. | :------------------------------------- | :--------------------------------------- |
  157. | spring-boot-starter | The core Spring Boot starter, including auto-configuration support, logging and YAML. |
  158. | spring-boot-starter-actuator | Production ready features to help you monitor and manage your application. |
  159. | spring-boot-starter-amqp | are neat |
  160. | spring-boot-starter-aop | Support for aspect-oriented programming including spring-aop and AspectJ. |
  161. | spring-boot-starter-artemis | Support for “Java Message Service API” via Apache Artemis. |
  162. | spring-boot-starter-batch | Support for “Spring Batch” including HSQLDB database. |
  163. | spring-boot-starter-cache | Support for Spring’s Cache abstraction. |
  164. | spring-boot-starter-cloud-connectors | Support for “Spring Cloud Connectors” which simplifies connecting to services in cloud platforms like Cloud Foundry and Heroku. |
  165. | spring-boot-starter-data-elasticsearch | Support for the Elasticsearch search and analytics engine including spring-data-elasticsearch. |
  166. | spring-boot-starter-data-gemfire | Support for the GemFire distributed data store including spring-data-gemfire. |
  167. | spring-boot-starter-data-jpa | Support for the “Java Persistence API” including spring-data-jpa, spring-orm and Hibernate. |
  168. | spring-boot-starter-data-mongodb | Support for the MongoDB NoSQL Database, including spring-data-mongodb. |
  169. | spring-boot-starter-data-rest | Support for exposing Spring Data repositories over REST via spring-data-rest-webmvc. |
  170. | spring-boot-starter-data-solr | Support for the Apache Solr search platform, including spring-data-solr. |
  171. | spring-boot-starter-freemarker | Support for the FreeMarker templating engine. |
  172. | spring-boot-starter-groovy-templates | Support for the Groovy templating engine. |
  173. | spring-boot-starter-hateoas | Support for HATEOAS-based RESTful services via spring-hateoas. |
  174. | spring-boot-starter-hornetq | Support for “Java Message Service API” via HornetQ. |
  175. | spring-boot-starter-integration | Support for common spring-integration modules. |
  176. | spring-boot-starter-jdbc | Support for JDBC databases. |
  177. | spring-boot-starter-jersey | Support for the Jersey RESTful Web Services framework. |
  178. | spring-boot-starter-jta-atomikos | Support for JTA distributed transactions via Atomikos. |
  179. | spring-boot-starter-jta-bitronix | Support for JTA distributed transactions via Bitronix. |
  180. | spring-boot-starter-mail | Support for javax.mail. |
  181. | spring-boot-starter-mobile | Support for spring-mobile. |
  182. | spring-boot-starter-mustache | Support for the Mustache templating engine. |
  183. | spring-boot-starter-redis | Support for the REDIS key-value data store, including spring-redis. |
  184. | spring-boot-starter-security | Support for spring-security. |
  185. | spring-boot-starter-social-facebook | Support for spring-social-facebook. |
  186. | spring-boot-starter-social-linkedin | Support for spring-social-linkedin. |
  187. | spring-boot-starter-social-twitter | Support for spring-social-twitter. |
  188. | spring-boot-starter-test | Support for common test dependencies, including JUnit, Hamcrest and Mockito along with the spring-test module. |
  189. | spring-boot-starter-thymeleaf | Support for the Thymeleaf templating engine, including integration with Spring. |
  190. | spring-boot-starter-velocity | Support for the Velocity templating engine. |
  191. | spring-boot-starter-web | Support for full-stack web development, including Tomcat and spring-webmvc. |
  192. | spring-boot-starter-websocket | Support for WebSocket development. |
  193. | spring-boot-starter-ws | Support for Spring Web Services. |
  194. # License
  195. [MIT](http://opensource.org/licenses/MIT)
  196. Copyright (c) 2017 Yangkai.Shen

一个用来深度学习并实战 spring boot 的项目,目前总共包含 66 个集成demo,已经完成 55 个。

Contributors (1)