Spring Cloud Alibaba
一、简介
1.1 官方描述
Spring Cloud Alibaba provides a one-stop solution for distributed application development. It contains all the components required to develop distributed applications, making it easy for you to develop your applications using Spring Cloud.
With Spring Cloud Alibaba, you only need to add some annotations and a small amount of configurations to connect Spring Cloud applications to the distributed solutions of Alibaba, and build a distributed application system with Alibaba middleware.
1.2 架构图
图片来源:processon
1.3 模块
二、项目搭建
2.1 maven
创建maven项目,配置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 http://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.2</version>
</parent>
<groupId>cn.flowboot.e.commerce</groupId>
<artifactId>E-commerce-cloud</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<!-- 工程项目版本 -->
<E-commerce-cloud>1.0-SNAPSHOT</E-commerce-cloud>
<!-- Spring Cloud 依赖 -->
<spring.cloud.version>Hoxton.SR12</spring.cloud.version>
<!-- spring cloud alibaba 依赖 -->
<spring.cloud.alibaba.version>2.2.7.RELEASE</spring.cloud.alibaba.version>
<!-- 依赖 -->
<lombok.version>1.16.18</lombok.version>
<!-- commons-lang3 依赖 -->
<commons-lang3.version>3.11</commons-lang3.version>
<!-- commons-collections4 依赖 -->
<commons-collections4.version>4.4</commons-collections4.version>
<!-- hutool-all 依赖 -->
<hutool-all.version>5.6.0</hutool-all.version>
<!-- jwt 依赖 -->
<jwt.version>0.11.2</jwt.version>
<!-- fastjson 依赖 -->
<fastjson.version>1.2.78</fastjson.version>
<!-- mybatis plus 依赖 -->
<mybatis-plus.version>3.4.2</mybatis-plus.version>
<!-- druid 依赖 -->
<druid.version>1.2.6</druid.version>
<!-- bitwalker 依赖 -->
<bitwalker.version>1.21</bitwalker.version>
<!-- 依赖 -->
<swagger.version>3.0.0</swagger.version>
<!-- kaptcha 依赖 -->
<kaptcha.version>2.3.2</kaptcha.version>
<!-- mybatis-spring 依赖 -->
<mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version>
<!-- pagehelper 依赖 -->
<pagehelper.boot.version>1.3.1</pagehelper.boot.version>
<!-- oshi 依赖 -->
<oshi.version>5.8.0</oshi.version>
<!-- jna 依赖 -->
<jna.version>5.8.0</jna.version>
<!-- io 依赖 -->
<commons.io.version>2.11.0</commons.io.version>
<!-- fileupload 依赖 -->
<commons.fileupload.version>1.4</commons.fileupload.version>
<!-- collections 依赖 -->
<commons.collections.version>3.2.2</commons.collections.version>
<!-- poi 依赖 -->
<poi.version>4.1.2</poi.version>
<!-- velocity 依赖 -->
<velocity.version>1.7</velocity.version>
</properties>
<!-- 项目依赖管理 父项目只是声明依赖,子项目需要写明需要的依赖(可以省略版本信息) -->
<dependencyManagement>
<dependencies>
<!-- spring cloud 依赖 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- spring cloud alibaba 依赖 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- lombok 工具通过在代码编译时期动态的将注解替换为具体的代码, IDEA 需要添加 lombok 插件 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-la