初始化网关项目
This commit is contained in:
26
yudao-gateway/pom.xml
Normal file
26
yudao-gateway/pom.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>yudao</artifactId>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>yudao-gateway</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>API 服务网关,基于 Spring Cloud Gateway 实现</description>
|
||||
<url>https://github.com/YunaiV/yudao-cloud</url>
|
||||
|
||||
<dependencies>
|
||||
<!-- 引入 Spring Cloud Gateway 相关依赖,使用它作为网关,并实现对其的自动配置 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.gateway;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class YudaoGatewayApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(YudaoGatewayApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
21
yudao-gateway/src/main/resources/application.yaml
Normal file
21
yudao-gateway/src/main/resources/application.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
server:
|
||||
port: 8888
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
# Spring Cloud Gateway 配置项,对应 GatewayProperties 类
|
||||
gateway:
|
||||
# 路由配置项,对应 RouteDefinition 数组
|
||||
routes:
|
||||
- id: yudaoyuanma # 路由的编号
|
||||
uri: https://www.iocoder.cn # 路由到的目标地址
|
||||
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
|
||||
- Path=/blog
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
- id: oschina # 路由的编号
|
||||
uri: https://www.oschina.net # 路由的目标地址
|
||||
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
|
||||
- Path=/oschina
|
||||
filters: # 过滤器,对请求进行拦截,实现自定义的功能,对应 FilterDefinition 数组
|
||||
- StripPrefix=1
|
||||
Reference in New Issue
Block a user