文章目录
- 简介
- 建立module
- 修改pom
- 修改yml
- 主启动类
- 把公共代码写在一个mudule 里面
- 测试
简介
这个是和之前的8001相互配合端口测试 这里的80的用户测试端口。
代码在:GitHub 上:https://github.com/13thm/study_springcloud/tree/main/days2
建立module
cloud-consumer-order80
修改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"><parent><artifactId>cloud_study</artifactId><groupId>org.example</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><groupId>com.cloud</groupId><artifactId>cloud-consumer-order80</artifactId><dependencies><dependency><!-- 引入自己定义的api通用包,可以使用Payment支付Entity --><groupId>org.example</groupId><artifactId>cloud-api-commons</artifactId><version>1.0-SNAPSHOT</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><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>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies></project>
修改yml
server:port: 80
主启动类
package com.cloud;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class OrderMain80
{public static void main(String[] args){SpringApplication.run(OrderMain80.class,args);}
}
把公共代码写在一个mudule 里面
建立一下文件;
之前的实体类写在这个公共的文件里面
修改需要他的,mudule里的pom的<dependencies>
添加一下。
<dependency><!-- 引入自己定义的api通用包,可以使用Payment支付Entity --><groupId>org.example</groupId><artifactId>cloud-api-commons</artifactId><version>1.0-SNAPSHOT</version></dependency>
测试
http://localhost/consumer/payment/create?serial=wwu001