1. 程式人生 > >Spring Cloud雲服務架構 - common-service 項目過程構建

Spring Cloud雲服務架構 - common-service 項目過程構建

activit 架構 rip mes edi service 2.4 .cn sta

我們將對common-service整個項目進行剖析,將整個構建的流程給記錄下來,讓更多的關註者來參考學習。

首先在構建spring cloud的common-service之前,我們需要準備的技術:

Maven(項目構建)、Spring Boot、Spring Cloud、微服務概念、去中心化思想、分布式等,針對於common-service的頂級項目,這裏我們主要使用Maven來構建,閑話少說,我們直接上代碼是最直觀的。

1. 創建一個Maven的頂級項目,其中pom.xml文件配置如下:

Xml代碼 技術分享圖片
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <parent>
  6. <groupId>org.springframework.cloud</groupId>
  7. <artifactId>spring-cloud-starter-parent</artifactId>
  8. <version>Dalston.RELEASE</version>
  9. <relativePath />
  10. </parent>
  11. <groupId>com.ml.honghu</groupId>
  12. <artifactId>particle-commonservice</artifactId>
  13. <version>0.0.1-SNAPSHOT</version>
  14. <packaging>pom</packaging>
  15. <name>particle-commonservice</name>
  16. <description>particle-commonservice project for Spring Boot</description>
  17. <modules>
  18. <module>particle-commonservice-config</module>
  19. <module>particle-commonservice-eureka</module>
  20. <module>particle-commonservice-mq</module>
  21. <module>particle-commonservice-cache</module>
  22. <module>particle-commonservice-sso</module>
  23. <module>particle-commonservice-apigateway</module>
  24. <module>particle-commonservice-zipkin</module>
  25. <module>particle-commonservice-admin</module>
  26. <module>particle-commonservice-turbine</module>
  27. <module>particle-commonservice-combine</module>
  28. <module>particle-commonservice-sequence</module>
  29. </modules>
  30. <properties>
  31. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  32. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  33. <java.version>1.8</java.version>
  34. <!-- 框架通用包版本設置 -->
  35. <validator.version>5.3.4.Final</validator.version>
  36. <shiro.version>1.2.3</shiro.version>
  37. <druid.version>1.0.26</druid.version>
  38. <mybatis-spring.version>1.2.2</mybatis-spring.version>
  39. <shiro.version>1.2.3</shiro.version>
  40. <druid.version>1.0.11</druid.version>
  41. <ehcache.version>2.6.9</ehcache.version>
  42. <ehcache-web.version>2.0.4</ehcache-web.version>
  43. <sitemesh.version>2.4.2</sitemesh.version>
  44. <activiti.version>5.15.1</activiti.version>
  45. <wink.version>1.4</wink.version>
  46. <sso.client.version>3.4.1</sso.client.version> -->
  47. <!-- 通用工具包版本設置 -->
  48. <slf4j.version>1.7.7</slf4j.version>
  49. <commons-lang3.version>3.3.2</commons-lang3.version>
  50. <commons-io.version>2.4</commons-io.version>
  51. <commons-codec.version>1.9</commons-codec.version>
  52. <commons-fileupload.version>1.3.1</commons-fileupload.version>
  53. <commons-beanutils.version>1.9.1</commons-beanutils.version>
  54. <fastjson.version>1.1.40</fastjson.version>
  55. <xstream.version>1.4.7</xstream.version>
  56. <guava.version>17.0</guava.version>
  57. <dozer.version>5.5.1</dozer.version>
  58. <email.version>1.4.7</email.version>
  59. <poi.version>3.9</poi.version>
  60. <cglib.version>3.2.5</cglib.version>
  61. <!-- aliyun -->
  62. <aliyun-sdk-oss.version>2.6.0</aliyun-sdk-oss.version>
  63. <aliyun-sdk-openservices-ons.version>1.2.7.Final</aliyun-sdk-openservices-ons.version>
  64. <com.ml.honghu.componet.version>0.0.1-SNAPSHOT</com.ml.honghu.componet.version>
  65. <spring-boot-admin.version>1.5.1</spring-boot-admin.version>
  66. <fastjson.version>1.2.35</fastjson.version>
  67. </properties>
  68. <dependencyManagement>
  69. <dependencies>
  70. <!-- spring cloud -->
  71. <dependency>
  72. <groupId>org.springframework.cloud</groupId>
  73. <artifactId>spring-cloud-dependencies</artifactId>
  74. <version>Dalston.RELEASE</version>
  75. <type>pom</type>
  76. <scope>import</scope>
  77. </dependency>
  78. <dependency>
  79. <groupId>org.jasig.cas.client</groupId>
  80. <artifactId>cas-client-core</artifactId>
  81. <version>3.4.1</version>
  82. </dependency>
  83. <dependency>
  84. <groupId>io.springfox</groupId>
  85. <artifactId>springfox-swagger2</artifactId>
  86. <version>2.5.0</version>
  87. </dependency>
  88. <dependency>
  89. <groupId>de.codecentric</groupId>
  90. <artifactId>spring-boot-admin-server</artifactId>
  91. <version>${spring-boot-admin.version}</version>
  92. </dependency>
  93. <dependency>
  94. <groupId>de.codecentric</groupId>
  95. <artifactId>spring-boot-admin-server-ui</artifactId>
  96. <version>${spring-boot-admin.version}</version>
  97. </dependency>
  98. <dependency>
  99. <groupId>de.codecentric</groupId>
  100. <artifactId>spring-boot-admin-server-ui-hystrix</artifactId>
  101. <version>${spring-boot-admin.version}</version>
  102. </dependency>
  103. <dependency>
  104. <groupId>de.codecentric</groupId>
  105. <artifactId>spring-boot-admin-server-ui-turbine</artifactId>
  106. <version>${spring-boot-admin.version}</version>
  107. </dependency>
  108. <dependency>
  109. <groupId>de.codecentric</groupId>
  110. <artifactId>spring-boot-admin-server-ui-login</artifactId>
  111. <version>${spring-boot-admin.version}</version>
  112. </dependency>
  113. <dependency>
  114. <groupId>de.codecentric</groupId>
  115. <artifactId>spring-boot-admin-server-ui-activiti</artifactId>
  116. <version>${spring-boot-admin.version}</version>
  117. </dependency>
  118. <dependency>
  119. <groupId>org.slf4j</groupId>
  120. <artifactId>slf4j-api</artifactId>
  121. <version>1.7.25</version>
  122. </dependency>
  123. <dependency>
  124. <groupId>com.ml.honghu</groupId>
  125. <artifactId>component-base</artifactId>
  126. <version>${com.ml.honghu.componet.version}</version>
  127. </dependency>
  128. <dependency>
  129. <groupId>com.ml.honghu</groupId>
  130. <artifactId>component-redis</artifactId>
  131. <version>${com.ml.honghu.componet.version}</version>
  132. </dependency>
  133. <dependency>
  134. <groupId>com.ml.honghu</groupId>
  135. <artifactId>component-utils</artifactId>
  136. <version>${com.ml.honghu.componet.version}</version>
  137. </dependency>
  138. <dependency>
  139. <groupId>com.ml.honghu</groupId>
  140. <artifactId>component-sequence-api</artifactId>
  141. <version>${com.ml.honghu.componet.version}</version>
  142. </dependency>
  143. <dependency>
  144. <groupId>com.ml.honghu</groupId>
  145. <artifactId>component-admin-ui-zipkin</artifactId>
  146. <version>${com.ml.honghu.componet.version}</version>
  147. </dependency>
  148. <dependency>
  149. <groupId>com.ml.honghu</groupId>
  150. <artifactId>component-admin-ui-route</artifactId>
  151. <version>${com.ml.honghu.componet.version}</version>
  152. </dependency>
  153. <dependency>
  154. <groupId>com.ml.honghu</groupId>
  155. <artifactId>component-zuul-label</artifactId>
  156. <version>${com.ml.honghu.componet.version}</version>
  157. </dependency>
  158. </dependencies>
  159. </dependencyManagement>
  160. </project>

當前的pom.xml文件引入了spring cloud相關版本配置,通用工具版本配置,honghu相關組件配置(因為其他的系統服務項目依賴於相關的組件,組件項目也是後面來創建的)

從現在開始,我這邊會將近期研發的spring cloud微服務雲架構的搭建過程和精髓記錄下來,幫助更多有興趣研發spring cloud框架的朋友,大家來一起探討spring cloud架構的搭建過程及如何運用於企業項目。 源碼來源

Spring Cloud雲服務架構 - common-service 項目過程構建