zoukankan      html  css  js  c++  java
  • Spring Cloud云服务架构

    上一篇我们介绍了《整合spring cloud云服务架构 - HongHu云架构common-service代码结构分析》,本节我们将对common-service整个项目进行剖析,将整个构建的流程给记录下来,让更多的关注者来参考学习。

    首先在构建spring cloud的common-service之前,我们需要准备的技术:

    Maven(项目构建)、Spring Boot、Spring Cloud、微服务概念、去中心化思想、分布式等,针对于common-service的顶级项目,这里我们主要使用Maven来构建,闲话少说,我们直接上代码是最直观的。

    1. 创建一个Maven的顶级项目,其中pom.xml文件配置如下:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    <parent>
    		<groupId>org.springframework.cloud</groupId>
    		<artifactId>spring-cloud-starter-parent</artifactId>
    		<version>Dalston.RELEASE</version>
    		<relativePath />
    	</parent>
    
    	<groupId>com.ml.honghu</groupId>
    	<artifactId>particle-commonservice</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    	<packaging>pom</packaging>
    
    	<name>particle-commonservice</name>
    	<description>particle-commonservice project for Spring Boot</description>
    
    	<modules>
    		<module>particle-commonservice-config</module>
    		<module>particle-commonservice-eureka</module>
    		<module>particle-commonservice-mq</module>
    		<module>particle-commonservice-cache</module>
    		<module>particle-commonservice-sso</module>
    		<module>particle-commonservice-apigateway</module>
    		<module>particle-commonservice-zipkin</module>
    		<module>particle-commonservice-admin</module>
    		<module>particle-commonservice-turbine</module>
    		<module>particle-commonservice-combine</module>
    		<module>particle-commonservice-sequence</module></modules><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><java.version>1.8</java.version><!-- 框架通用包版本设置 --><validator.version>5.3.4.Final</validator.version><shiro.version>1.2.3</shiro.version><druid.version>1.0.26</druid.version><mybatis-spring.version>1.2.2</mybatis-spring.version><shiro.version>1.2.3</shiro.version><druid.version>1.0.11</druid.version><ehcache.version>2.6.9</ehcache.version><ehcache-web.version>2.0.4</ehcache-web.version><sitemesh.version>2.4.2</sitemesh.version><activiti.version>5.15.1</activiti.version><wink.version>1.4</wink.version><sso.client.version>3.4.1</sso.client.version> -->
    
    		<!-- 通用工具包版本设置 --><slf4j.version>1.7.7</slf4j.version><commons-lang3.version>3.3.2</commons-lang3.version><commons-io.version>2.4</commons-io.version><commons-codec.version>1.9</commons-codec.version><commons-fileupload.version>1.3.1</commons-fileupload.version><commons-beanutils.version>1.9.1</commons-beanutils.version><fastjson.version>1.1.40</fastjson.version><xstream.version>1.4.7</xstream.version><guava.version>17.0</guava.version><dozer.version>5.5.1</dozer.version><email.version>1.4.7</email.version><poi.version>3.9</poi.version><cglib.version>3.2.5</cglib.version><!-- aliyun --><aliyun-sdk-oss.version>2.6.0</aliyun-sdk-oss.version><aliyun-sdk-openservices-ons.version>1.2.7.Final</aliyun-sdk-openservices-ons.version><com.ml.honghu.componet.version>0.0.1-SNAPSHOT</com.ml.honghu.componet.version><spring-boot-admin.version>1.5.1</spring-boot-admin.version><fastjson.version>1.2.35</fastjson.version></properties><dependencyManagement><dependencies><!-- spring cloud --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>Dalston.RELEASE</version><type>pom</type><scope>import</scope></dependency><dependency><groupId>org.jasig.cas.client</groupId><artifactId>cas-client-core</artifactId><version>3.4.1</version></dependency><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.5.0</version></dependency><dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-server</artifactId><version>${spring-boot-admin.version}</version></dependency><dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-server-ui</artifactId><version>${spring-boot-admin.version}</version></dependency><dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-server-ui-hystrix</artifactId><version>${spring-boot-admin.version}</version></dependency><dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-server-ui-turbine</artifactId><version>${spring-boot-admin.version}</version></dependency><dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-server-ui-login</artifactId><version>${spring-boot-admin.version}</version></dependency><dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-server-ui-activiti</artifactId><version>${spring-boot-admin.version}</version></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.7.25</version></dependency><dependency><groupId>com.ml.honghu</groupId><artifactId>component-base</artifactId><version>${com.ml.honghu.componet.version}</version></dependency><dependency><groupId>com.ml.honghu</groupId><artifactId>component-redis</artifactId><version>${com.ml.honghu.componet.version}</version></dependency><dependency><groupId>com.ml.honghu</groupId><artifactId>component-utils</artifactId><version>${com.ml.honghu.componet.version}</version></dependency><dependency><groupId>com.ml.honghu</groupId><artifactId>component-sequence-api</artifactId><version>${com.ml.honghu.componet.version}</version></dependency><dependency><groupId>com.ml.honghu</groupId><artifactId>component-admin-ui-zipkin</artifactId><version>${com.ml.honghu.componet.version}</version></dependency><dependency><groupId>com.ml.honghu</groupId><artifactId>component-admin-ui-route</artifactId><version>${com.ml.honghu.componet.version}</version></dependency><dependency><groupId>com.ml.honghu</groupId><artifactId>component-zuul-label</artifactId><version>${com.ml.honghu.componet.version}</version></dependency></dependencies></dependencyManagement></project>

    当前的pom.xml文件引入了spring cloud相关版本配置,通用工具版本配置,honghu相关组件配置(因为其他的系统服务项目依赖于相关的组件,组件项目也是后面来创建的)

    从现在开始,我这边会将近期研发的spring cloud微服务云架构的搭建过程和精髓记录下来,帮助更多有兴趣研发spring cloud框架的朋友,大家来一起探讨spring cloud架构的搭建过程及如何运用于企业项目。 资料和源码来源

  • 相关阅读:
    Linux
    《移动群智感知网络》阅读笔记
    JAVA小记
    数据结构第十章:内部排序
    数据结构第九章:查找
    Oracle 物化视图(materialized view)
    Oracle Function 开启事务以及Update返回更新成功条数
    oracle存储过程的update并获取结果记录
    单例模式实现Demo
    winform BackgroundWorker组件操作
  • 原文地址:https://www.cnblogs.com/hhh3/p/8063932.html
Copyright © 2011-2022 走看看