zoukankan      html  css  js  c++  java
  • 微服务网关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、启动网关

  • 相关阅读:
    js Array的方法及属性总结
    js 继承
    js 判断数据类型
    序列化和反序列化
    express 常用方法和插件
    node 常用的对象
    node.js 守护进程
    CentOS7安装Python3.8.1和ansible
    MAC终端终极美化方案
    Linux之top命令详解
  • 原文地址:https://www.cnblogs.com/smalldong/p/13911187.html
Copyright © 2011-2022 走看看