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

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

首先在構建spring cloud的common-service以前,咱們須要準備的技術:java

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

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

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

 

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

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

相關文章
相關標籤/搜索