(七)整合spring cloud云服务架构 - common-service 项目构建过程

news/2024/7/7 14:31:29 标签: java, 区块链

我们将对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架构的搭建过程及如何运用于企业项目。Spring Cloud大型企业分布式微服务云构建的B2B2C电子商务平台源码请加企鹅求求:一零三八七七四六二六


转载于:https://juejin.im/post/5c6ba2a56fb9a04a0b22bdc4


http://www.niftyadmin.cn/n/835559.html

相关文章

阿里HBase的数据管道设施实践与演进

摘要&#xff1a; 大数据生态下有着丰富多样的系统&#xff1a;流计算&#xff0c;数据存储&#xff0c;实时分析&#xff0c;离线计算&#xff0c;数据在各个异构系统之间的流转和加工而产生价值&#xff0c;高效的数据传输通道是大数据生态的重要一环。本文描述了阿里HBase团…

Intel处理器供应紧张最晚4季度缓解,俄勒冈州新工厂6月底前开建 ...

雷锋网(公众号&#xff1a;雷锋网)此前报道&#xff0c;Intel首席财务官兼临时首席执行官Bob Swan去年9月的一封公开信承认了Intel部分产品供应紧张的问题&#xff0c;并概述了Intel为解决这一问题所采取的一系列行动。对此问题&#xff0c;一方面&#xff0c;Intel的产品供不应…

CSS---伪元素

选择器功能:first-letter操作当前元素中的第一个字:first-line操作当前元素中的第一行::before在之前插入&#xff0c;在一个盒子内部的最前面::after在之后插入&#xff0c;在一个盒子内部的最后面 <!DOCTYPE html> <html lang"en"> <head><me…

面试官问我:什么是JavaScript闭包,我该如何回答

闭包&#xff0c;有人说它是一种设计理念&#xff0c;有人说所有的函数都是闭包。到底什么是闭包&#xff1f;这个问题在面试是时候经常都会被问&#xff0c;很多小白一听就懵逼了&#xff0c;不知道如何回答好。这个问题也有很多朋友在公众号给李老师留言了&#xff0c;问题表…

fragment 动态加载

/*** 测试使用Fragment(动态使用) 1.* 使用FragmentManager和FragmentTransaction动态使用一个Fragment 2. 方式:* add(viewId, fragment): 将fragment的视图添加为指定视图的子视图(加在原有子视图的后面)* replace(viewId, fragment): 将fragment的视…

vue里实现echarts中国地图

2019独角兽企业重金招聘Python工程师标准>>> echartsDemo.vue <template><div><div id"chart_example"></div></div> </template><script>// 首先要 cnpm install echartsimport echarts from echartsimport .…

圆角矩形

圆角矩形&#xff1a; border-radius: 左上 右上 右下 左下; <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0">&l…

python 读csv格式的文件

对于大多数的CSV 格式的数据读写问题&#xff0c;都可以使用csv 库 1. 直接读csv 以下是要操作的csv文件内容 import csv with open(rC:\Temp\f.csv) as f:f_csvcsv.reader(f)headersnext(f_csv)for row in f_csv:print(row)这里的row是元组&#xff0c;为了访问某个字段&#…