SaaS平台开发实战(一):快速搭建环境
在搭建框架之前,我们需要准备一台测试服务器,我用的是华为云4核-16G服务器。花费接近2K左右(首年优惠)
安装服务器环境(准备工作)
请在服务器安装redis(7.0.11)、mysql(8.0)、seata(1.6.1)、sentinel(1.8.6),nacos(2.2.3)如何安装请自行百度
准备开发环境
>>> 安装idea (请在百度搜索,此处略过)
克隆基础框架
git clone https://github.com/kutasms/multienty.git
执行安装基础框架
mvn clean install
新建Maven项目

新建核心模块

增加properties配置
1 <properties> 2 <java.version>1.8</java.version> 3 <chia.multienty.verion>2024.1.1</chia.multienty.verion> 4 <springboot.version>2.6.13</springboot.version> 5 <spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version> 6 <spring.cloud.version>2021.0.5</spring.cloud.version> 7 <lombok.version>1.18.8</lombok.version> 8 <swagger.version>2.8.0</swagger.version> 9 <dubbo.version>3.0.8</dubbo.version> 10 <seata.version>1.6.1</seata.version> 11 <yaml.version>1.33</yaml.version> 12 </properties>
配置springboot环境
1 <parent> 2 <groupId>org.springframework.boot</groupId> 3 <artifactId>spring-boot-starter-parent</artifactId> 4 <version>2.6.13</version> 5 <relativePath/> 6 </parent>
配置dependencyManagement
1 <dependencyManagement> 2 <dependencies> 3 <dependency> 4 <groupId>com.chia</groupId> 5 <artifactId>multienty-spring-boot-starter</artifactId> 6 <version>${chia.multienty.verion}</version> 7 </dependency> 8 <dependency> 9 <groupId>org.springframework.boot</groupId> 10 <artifactId>spring-boot-starter-data-redis</artifactId> 11 <version>${springboot.version}</version> 12 <exclusions> 13 <exclusion> 14 <groupId>io.lettuce</groupId> 15 <artifactId>lettuce-core</artifactId> 16 </exclusion> 17 </exclusions> 18 </dependency> 19 <dependency> 20 <groupId>com.alibaba.cloud</groupId> 21 <artifactId>spring-cloud-alibaba-dependencies</artifactId> 22 <version>${spring-cloud-alibaba.version}</version> 23 <type>pom</type> 24 <scope>import</scope> 25 </dependency> 26 <dependency> 27 <groupId>org.springframework.cloud</groupId> 28 <artifactId>spring-cloud-dependencies</artifactId> 29 <version>${spring.cloud.version}</version> 30 <type>pom</type> 31 <scope>import</scope> 32 </dependency> 33 <dependency> 34 <groupId>org.apache.dubbo</groupId> 35 <artifactId>dubbo</artifactId> 36 <version>${dubbo.version}</version> 37 </dependency> 38 <dependency> 39 <groupId>io.seata</groupId> 40 <artifactId>seata-all</artifactId> 41 <version>${seata.version}</version> 42 <scope>compile</scope> 43 </dependency> 44 </dependencies> 45 </dependencyManagement>
配置dependencies
1 <dependencies> 2 <dependency> 3 <groupId>org.yaml</groupId> 4 <artifactId>snakeyaml</artifactId> 5 <version>${yaml.version}</version> 6 </dependency> 7 <dependency> 8 <groupId>org.springframework.boot</groupId> 9 <artifactId>spring-boot-configuration-processor</artifactId> 10 <optional>true</optional> 11 </dependency> 12 <dependency> 13 <groupId>org.springframework.cloud</groupId> 14 <artifactId>spring-cloud-starter-config</artifactId> 15 </dependency> 16 <dependency> 17 <groupId>org.springframework.boot</groupId> 18 <artifactId>spring-boot-starter-test</artifactId> 19 <scope>test</scope> 20 <exclusions> 21 <exclusion> 22 <groupId>org.yaml</groupId> 23 <artifactId>snakeyaml</artifactId> 24 </exclusion> 25 </exclusions> 26 </dependency> 27 <dependency> 28 <groupId>junit</groupId> 29 <artifactId>junit</artifactId> 30 <version>4.13.1</version> 31 </dependency> 32 <dependency> 33 <groupId>org.springframework.boot</groupId> 34 <artifactId>spring-boot-starter-aop</artifactId> 35 <version>${springboot.version}</version> 36 </dependency> 37 <dependency> 38 <groupId>org.springframework.boot</groupId> 39 <artifactId>spring-boot-starter-validation</artifactId> 40 <version>${springboot.version}</version> 41 </dependency> 42 43 <!--lombok--> 44 <dependency> 45 <groupId>org.projectlombok</groupId> 46 <artifactId>lombok</artifactId> 47 <version>${lombok.version}</version> 48 </dependency> 49 <dependency> 50 <groupId>com.github.xiaoymin</groupId> 51 <artifactId>knife4j-spring-boot-starter</artifactId> 52 <!--在引用时请在maven中央仓库搜索最新版本号--> 53 <version>2.0.2</version> 54 <exclusions> 55 <exclusion> 56 <groupId>org.javassist</groupId> 57 <artifactId>javassist</artifactId> 58 </exclusion> 59 </exclusions> 60 </dependency> 61 </dependencies>
重新加载maven
配置saasdemo-core模块pom文件
1 <dependencies> 2 <dependency> 3 <groupId>com.chia</groupId> 4 <artifactId>multienty-spring-boot-starter</artifactId> 5 <version>${chia.multienty.verion}</version> 6 </dependency> 7 </dependencies>
编译Parent
mvn clean install
至此,基础环境搭建完毕,下章开始将说明CRUD以及链表查询等基础操作。

浙公网安备 33010602011771号