引用笔记Spring Cloud 学习笔记(1 / 3)_KISS-CSDN博客Spring Cloud 学习笔记(2 / 3)Spring Cloud 学习笔记(3 / 3)---01_前言闲聊和课程说明02_零基础微服务架构理论入门03_第二季Boot和Cloud版本选型04_Cloud组件停更说明05_父工程Project空间新建06_父工程pom文件07_复习DependencyManagement和Dependencies08_支付模块构建(上)09_支付模块构建(中)10_支付模块构建(下)11_热部署Devtoolhttps://blog.csdn.net/u011863024/article/details/114298270
14-?工程重构
由于cloud-consumer-order80工程和cloud-provider-payment8001有公共的实体类Payment,所以
可以将它抽离到common的公共module中,以便其他项目使用
1.新建cloud-api-commons项目,添加依赖
<?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>
<artifactId>cloud2020</artifactId>
<groupId>org.atguigu.springcloud</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.atguigu.springcloud</groupId>
<artifactId>cloud-api-commons</artifactId>
<version>1.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
</project>
2.将cloud-consumer-order80与cloud-provider-payment8001两工程的公有entity包移至cloud-api-commons工程下。
?3.maven先clean,再install,添加到maven仓库
?4.父工程添加依赖
<properties>
<commons.version>1.0.0-SNAPSHOT</commons.version>
</properties>
<dependency>
<groupId>com.atguigu.springcloud</groupId>
<artifactId>cloud-api-commons</artifactId>
<version>${commons.version}</version>
</dependency>
5.子工程引用依赖
<!-- 引入自己定义的api通用包,可以使用Payment支付Entity -->
<dependency>
<groupId>com.atguigu.springcloud</groupId>
<artifactId>cloud-api-commons</artifactId>
</dependency>
|