springcloud Client端cloud-consumer-order80

文章目录

  • 简介
  • 建立module
  • 修改pom
  • 修改yml
  • 主启动类
  • 把公共代码写在一个mudule 里面
  • 测试

简介

这个是和之前的8001相互配合端口测试 这里的80的用户测试端口。
代码在:GitHub 上:https://github.com/13thm/study_springcloud/tree/main/days2

建立module

cloud-consumer-order80
springcloud Client端cloud-consumer-order80_第1张图片

修改pom


<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_studyartifactId>
        <groupId>org.examplegroupId>
        <version>1.0-SNAPSHOTversion>
    parent>
    <modelVersion>4.0.0modelVersion>

    <groupId>com.cloudgroupId>
    <artifactId>cloud-consumer-order80artifactId>

    <dependencies>
        <dependency>
            <groupId>org.examplegroupId>
            <artifactId>cloud-api-commonsartifactId>
            <version>1.0-SNAPSHOTversion>
        dependency>

        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-actuatorartifactId>
        dependency>

        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-devtoolsartifactId>
            <scope>runtimescope>
            <optional>trueoptional>
        dependency>
        <dependency>
            <groupId>org.projectlombokgroupId>
            <artifactId>lombokartifactId>
            <optional>trueoptional>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-testartifactId>
            <scope>testscope>
        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 里面

建立一下文件;
在这里插入图片描述
之前的实体类写在这个公共的文件里面
springcloud Client端cloud-consumer-order80_第2张图片
修改需要他的,mudule里的pom的添加一下。

 <dependency>
            <groupId>org.examplegroupId>
            <artifactId>cloud-api-commonsartifactId>
            <version>1.0-SNAPSHOTversion>
        dependency>

测试

http://localhost/consumer/payment/create?serial=wwu001

springcloud Client端cloud-consumer-order80_第3张图片

你可能感兴趣的:(springcloud,spring,cloud,java,spring,boot)