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、启动网关

  • 相关阅读:
    看到差距了,受打击
    数码相机选购指南(应小麻之作)
    sorry
    ACM集训第一天
    没事了,放心了,回到自己,又有些失落
    黑暗世界的一线光明

    无忧无虑的睡去,是一种奢华的享受(新)
    一些废话
    对事不对人
  • 原文地址:https://www.cnblogs.com/smalldong/p/13911187.html
Copyright © 2011-2022 走看看