Spring cloud Alibaba 分布式微服务,配置 nacos + gateway + feign + hystrix

Spring cloud Alibaba 分布式微服务,配置 nacos + gateway + feign + hystrix - 根目录97 - 博客园

Spring cloud Alibaba 分布式微服务,配置 nacos + gateway + feign + hystrix

这篇随笔本人2021/04/09 原创,应该目前看了这篇博客的人都能搭成功。

环境:IDEA ,JDK 1.8, Mysql 5.* 

项目配置:nacos + gateway + feign + hystrix + mybatis plus

mybatis plus 我有在另一篇博文里写过,有兴趣的可以去看:https://www.cnblogs.com/anpieBlog/p/14607131.html

很多初学者被网上各种博文搞得头昏眼花,从第一步就开始创建项目,搞到最后也没搞出来。

第一步:搭建Spring cloud Alibaba 需要先装nacos服务。这里我使用的1.4.1

nacos服务下载地址:https://github.com/alibaba/nacos/releases/tag/1.4.1

下载完成后,不能直接双击startup.cmd运行,会报错,需要进入cmd命令,使用命令行启动

 这个样子就算成功了。

第二步:创建父项目

 

 

 ali-nacos的pom

复制代码

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <!--<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.4</version>
        <relativePath/> &lt;!&ndash; lookup parent from repository &ndash;&gt;
    </parent>-->
    <groupId>com.anear</groupId>
    <artifactId>ali-nacos</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>

    <!--<modules>
        <module>**</module>
        <module>**</module>
        <module>**</module> <!-- 配置子项目的地方,先注掉,后面一个个放开配置 -->
        <module>**</module>
        <module>**</module>
    </modules>-->
    <name>studycloud</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <junit.version>4.12</junit.version>
        <log4j.version>1.2.17</log4j.version>
        <lombok.version>1.16.18</lombok.version>
        <mysql.version>8.0.23</mysql.version>
        <druid.version>1.1.16</druid.version>
        <mybatis.spring.boot.version>1.3.0</mybatis.spring.boot.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <!--spring boot 2.2.2-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.2.2.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!--spring cloud Hoxton.SR1-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Hoxton.SR1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!--spring cloud alibaba 2.1.0.RELEASE-->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>2.1.0.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql.version}</version>
            </dependency>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
                <version>${druid.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值