⑦. 从0搭建各个微服务项目
①. IDEA然后New Module–Spring Initializer–com.atguigu.gulimall , Artifact填 gulimall-product。Next—选择web(web开发),springcloud routing里选中openFeign(rpc调用)
②. 依次创建出以下服务
(商品服务product、存储服务ware、订单服务order、优惠券服务coupon、用户服务member)
③. 共同点
导入web和openFeign
group:com.atguigu.gulimall
Artifact:gulimall-XXX
每一个服务,包名com.atguigu.gulimall.XXX{product/order/ware/coupon/member}
模块名:gulimall-XXX
④. 然后右下角显示了springboot的service选项,选择它
⑤. 从某个项目粘贴个pom.xml粘贴到项目目录,修改它
<?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> <groupId>com.atguigu.gulimall</groupId> <artifactId>gulimall</artifactId> <version>0.0.1-SNAPSHOT</version> <name>gulimall</name> <description>聚合服务</description> <packaging>pom</packaging> <modules> <module>gulimall-product</module> <module>gulimall-ware</module> <module>gulimall-order</module> <module>gulimall-coupon</module> <module>gulimall-member</module> </modules> </project>
⑥. 修改总项目的.gitignore,把小项目里的垃圾文件在提交的时候忽略掉,比如HELP.md
target/ pom.xml.tag pom.xml.releaseBackup pom.xml.versionsBackup pom.xml.next release.properties dependency-reduced-pom.xml buildNumber.properties .mvn/timing.properties .mvn/wrapper/maven-wrapper.jar **/mvnw **/mvnw.cmd **/.mvn **/target/ .idea **/.gitignore