• 微服务网关2-搭建Gateway服务


    一、创建父模块infrastructure

    1、创建模块

    在guli_parent下创建普通maven模块
    Artifact:infrastructure

    2、删除src目录

    二、创建模块api_gateway

    1、创建模块

    在infrastructure下创建普通maven模块
    Artifact:api_gateway

    2、配置pom

    在api_gateway的pom中添加如下依赖

    <dependencies>
        <!-- 网关 -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
        </dependency>
    </dependencies>
    

    3、配置application.yml

    server:
      port: 9110 # 服务端口
    
    spring:
      profiles:
        active: dev # 环境设置
      application:
        name: infrastructure-apigateway # 服务名
    

    4、logback.xml

    修改日志输出的目录名为 apigateway

     <property name="log.path" value="D:/project/helen/guli_log/apigateway" />
    

    5、创建启动类

    package com.atguigu.guli.infrastructure.apigateway;
    
    @SpringBootApplication
    public class InfrastructureApiGatewayApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(InfrastructureApiGatewayApplication.class, args);
        }
    }
    

    6、启动网关

  • 相关阅读:
    函数中,易遗忘记载
    常用函数源码
    装饰器之自我理解
    函数名、闭包及迭代器
    函数2
    trap(陷井)
    文件操作
    搭建Pxe引导RamOS Linux内存系统
    X86服务器BMC基板管理控制器介绍
    Linux操作系统自动部署--镜像格式qcow2
  • 原文地址:https://www.cnblogs.com/smalldong/p/13911187.html
Copyright © 2020-2023  润新知