gateway support

pull/4/head
fengyu.wang 4 years ago
parent 07a37581ba
commit 83e50a26a3
  1. 1
      spring-cloud/pom.xml
  2. 41
      spring-cloud/spring-cloud-gateway/pom.xml
  3. 14
      spring-cloud/spring-cloud-gateway/src/main/java/com/blockchain/spring/cloud/gateway/GatewayApplication.java
  4. 82
      spring-cloud/spring-cloud-gateway/src/main/resources/application.yml

@ -16,6 +16,7 @@
<module>spring-cloud-eureka</module>
<module>spring-cloud-hystrix-dashboard</module>
<module>spring-cloud-config</module>
<module>spring-cloud-gateway</module>
</modules>

@ -0,0 +1,41 @@
<?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>spring-cloud</artifactId>
<groupId>com.blockchain</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-cloud-gateway</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,14 @@
package com.blockchain.spring.cloud.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
@EnableEurekaClient
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class,args);
}
}

@ -0,0 +1,82 @@
server:
port: 8003
spring:
application:
name: dapp-gateway-server
cloud:
gateway:
routes:
- id: blockchain-server-btc
uri: lb://dapp-btc-server
predicates:
- Path=/btc/**
filters:
- StripPrefix=1
- id: blockchain-server-cct
uri: lb://dapp-cct-server
predicates:
- Path=/cct/**
filters:
- StripPrefix=1
- id: blockchain-server-currency
uri: lb://dapp-currency-server
predicates:
- Path=/currency/**
filters:
- StripPrefix=1
- id: blockchain-server-databot
uri: lb://dapp-databot-server
predicates:
- Path=/databot/**
filters:
- StripPrefix=1
- id: blockchain-server-eos
uri: lb://dapp-eos-server
predicates:
- Path=/eos/**
filters:
- StripPrefix=1
- id: blockchain-server-eth
uri: lb://dapp-eth-server
predicates:
- Path=/eth/**
filters:
- StripPrefix=1
- id: blockchain-server-imjg
uri: lb://dapp-imjg-server
predicates:
- Path=/imjg/**
filters:
- StripPrefix=1
- id: blockchain-server-otc
uri: lb://dapp-otc-server
predicates:
- Path=/otc/**
filters:
- StripPrefix=1
- id: blockchain-server-sysconf
uri: lb://dapp-sysconf-server
predicates:
- Path=/sysconf/**
filters:
- StripPrefix=1
- id: blockchain-server-user
uri: lb://dapp-user-server
predicates:
- Path=/user/**
filters:
- StripPrefix=1
- id: blockchain-server-yyyf
uri: lb://dapp-yyyf-server
predicates:
- Path=/yyyfuser/**
filters:
- StripPrefix=1
eureka:
client:
service-url:
defaultZone: http://${eureka-host}:8001/eureka/
instance:
prefer-ip-address: true
instance-id: ${spring.cloud.client.ip-address}:${server.port}
hostname: ${spring.cloud.client.ip-address}
Loading…
Cancel
Save