一、創建父模塊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、啟動網關

