Skip to content

SpringCloud系列Demo代码,每个子项目都是SpringCloud的一个知识点或者说技能点且都有对应的博客介绍,代码开箱即用适合新手学习或老司机复习

License

huanzi-qch/springCloud

Repository files navigation

官网

https://huanzi-qch.gitee.io/spring-cloud

简介

SpringCloud系列Demo代码

SpringCloud的Demo代码包括了一下分布式的基本组件,具体请看博客、代码
父项目是一个maven项目,继承spring-boot-starter-parent,引入spring-cloud依赖管理,同时引入了部分公用依赖

    <!--  父类继承spring-boot-starter-parent  -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
        <relativePath/>
    </parent>
    
    <!-- 引入spring-cloud依赖管理 -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Greenwich.RC1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!-- 在父类引入一下通用的依赖 -->
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Greenwich.RC1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>

        <!-- spring-boot-starter -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <!-- springboot web(MVC)-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!-- springboot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- actuator -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <!--lombok插件 -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>

        <!--热部署工具dev-tools-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <!-- 仓库地址 -->
    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
        </repository>
    </repositories>

每个子项目都是一个独立的SpringBoot项目,子项目直接继承父类

    <!--继承父类-->
    <parent>
        <groupId>cn.huanzi.qch</groupId>
        <artifactId>parent</artifactId>
        <version>1.0.0</version>
    </parent>

每个子项目都是SpringCloud的一个知识点或者说技能点,具体见名思意!具体介绍都有对应的博客,详情请看下方的“前往博客查看详情”
SpringCloud代码跟之前写博客时有所改动,现在的项目命名更加规范,比较利于理解

改动后测试例子:
PS:由于图片是引入我博客里面的图片,有时会出现显示不出来的问题,可以直接前往博客-->点击目录:SpringCloud系列,即可查看效果图

eureka注册

sso单点登录

令牌桶限流

feign调用

ribbon负载均衡

txlcn分布式事务

事务回滚

事务提交

仓库地址

国外:https://github.com/huanzi-qch/springCloud
国内:https://gitee.com/huanzi-qch/springCloud

前往博客查看详情

具体介绍请看我的博客《SpringCloud系列》

项目 博客
config-server SpringCloud系列——Config 配置中心
SpringCloud系列——Bus 消息总线
eureka-server SpringCloud系列——Eureka 服务注册与发现
sso-server SpringCloud系列——SSO 单点登录
txlcn-tm SpringCloud系列——TX-LCN分布式事务管理
zuul-server SpringCloud系列——Zuul 动态路由
zipkin-server SpringCloud系列——分布式链路追踪
server-a
server-b1/b2
server-c
SpringCloud系列——Feign 服务调用
server-b1/b2 SpringCloud系列——Ribbon 负载均衡

AD广告位 (长期招租,如有需要请私信)

【基塔后台】免费后台管理系统,低代码快速搭建管理后台

【阿里云】阿里云最全的优惠活动聚集地!
【腾讯云】腾讯云当前最新优惠活动专区!

QQ群

有事请加群,有问题进群大家一起交流!

捐献

相应的资金支持能更好的持续项目的维护和开发,如果喜欢这个项目,请随意打赏!

支付宝 微信

学习资料

Spring全家桶的GitHub:https://github.com/spring-projects
SpringCloud官方文档:https://spring.io/projects/spring-cloud
SpringCloud官方GitHub:https://github.com/spring-cloud

这些资料有丰富的文档介绍、代码示例

About

SpringCloud系列Demo代码,每个子项目都是SpringCloud的一个知识点或者说技能点且都有对应的博客介绍,代码开箱即用适合新手学习或老司机复习

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published