首页 > 其他 > 详细

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

时间:2020-11-01 21:55:40      阅读:71      评论:0      收藏:0      [点我收藏+]

一、创建父模块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-搭建Gateway服务

原文:https://www.cnblogs.com/smalldong/p/13911187.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!