From 987e733edd5b326eb0f1db1fcbfb2f876c9d00fb Mon Sep 17 00:00:00 2001 From: Brandon Ward Date: Wed, 28 Dec 2022 20:21:53 -0700 Subject: [PATCH] Move rate limiting examples --- spring-cloud-modules/pom.xml | 1 + .../spring-cloud-gateway-2/README.md | 7 + .../spring-cloud-gateway-2/pom.xml | 124 ++++++++++++++++++ .../springcloudgateway/GatewayApplication | 14 ++ .../ipaddress/IpAddressApplication.java | 0 .../ProxiedClientAddressResolver.java | 0 .../SimpleClientAddressResolver.java | 0 .../ipaddress-application.properties | 0 .../spring-cloud-gateway/README.md | 1 - 9 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 spring-cloud-modules/spring-cloud-gateway-2/README.md create mode 100644 spring-cloud-modules/spring-cloud-gateway-2/pom.xml create mode 100644 spring-cloud-modules/spring-cloud-gateway-2/src/main/java/com/baeldung/springcloudgateway/GatewayApplication rename spring-cloud-modules/{spring-cloud-gateway => spring-cloud-gateway-2}/src/main/java/com/baeldung/springcloudgateway/ipaddress/IpAddressApplication.java (100%) rename spring-cloud-modules/{spring-cloud-gateway => spring-cloud-gateway-2}/src/main/java/com/baeldung/springcloudgateway/ipaddress/ProxiedClientAddressResolver.java (100%) rename spring-cloud-modules/{spring-cloud-gateway => spring-cloud-gateway-2}/src/main/java/com/baeldung/springcloudgateway/ipaddress/SimpleClientAddressResolver.java (100%) rename spring-cloud-modules/{spring-cloud-gateway => spring-cloud-gateway-2}/src/main/resources/ipaddress-application.properties (100%) diff --git a/spring-cloud-modules/pom.xml b/spring-cloud-modules/pom.xml index 7a4eec679e..68aa4cd2e5 100644 --- a/spring-cloud-modules/pom.xml +++ b/spring-cloud-modules/pom.xml @@ -25,6 +25,7 @@ spring-cloud-ribbon-client spring-cloud-zookeeper spring-cloud-gateway + spring-cloud-gateway-2 spring-cloud-stream spring-cloud-stream-starters spring-cloud-connectors-heroku diff --git a/spring-cloud-modules/spring-cloud-gateway-2/README.md b/spring-cloud-modules/spring-cloud-gateway-2/README.md new file mode 100644 index 0000000000..578bfc623e --- /dev/null +++ b/spring-cloud-modules/spring-cloud-gateway-2/README.md @@ -0,0 +1,7 @@ +## Spring Cloud Gateway 2 + +This module contains additional articles about Spring Cloud Gateway. + +### Relevant Articles: + +- [Rate Limiting With Client IP in Spring Cloud Gateway](https://www.baeldung.com/spring-cloud-gateway-rate-limit-by-client-ip) diff --git a/spring-cloud-modules/spring-cloud-gateway-2/pom.xml b/spring-cloud-modules/spring-cloud-gateway-2/pom.xml new file mode 100644 index 0000000000..22182e8c78 --- /dev/null +++ b/spring-cloud-modules/spring-cloud-gateway-2/pom.xml @@ -0,0 +1,124 @@ + + + 4.0.0 + spring-cloud-gateway-2 + spring-cloud-gateway-2 + jar + + + com.baeldung.spring.cloud + spring-cloud-modules + 1.0.0-SNAPSHOT + + + + + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud-dependencies.version} + pom + import + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + + + + org.springframework.cloud + spring-cloud-starter-gateway + + + + org.springframework.boot + spring-boot-starter-data-redis-reactive + + + + it.ozimov + embedded-redis + ${redis.version} + test + + + org.hibernate + hibernate-validator-cdi + ${hibernate-validator.version} + + + javax.validation + validation-api + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-devtools + + + + org.springframework.boot + spring-boot-starter-oauth2-resource-server + + + org.springframework.boot + spring-boot-starter-oauth2-client + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${java.version} + ${java.version} + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + + 6.0.2.Final + 0.7.2 + 9.19 + + + \ No newline at end of file diff --git a/spring-cloud-modules/spring-cloud-gateway-2/src/main/java/com/baeldung/springcloudgateway/GatewayApplication b/spring-cloud-modules/spring-cloud-gateway-2/src/main/java/com/baeldung/springcloudgateway/GatewayApplication new file mode 100644 index 0000000000..53b2629dd0 --- /dev/null +++ b/spring-cloud-modules/spring-cloud-gateway-2/src/main/java/com/baeldung/springcloudgateway/GatewayApplication @@ -0,0 +1,14 @@ +package com.baeldung.springcloudgateway; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; + +@SpringBootApplication +public class GatewayApplication { + + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class, args); + } + +} \ No newline at end of file diff --git a/spring-cloud-modules/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/ipaddress/IpAddressApplication.java b/spring-cloud-modules/spring-cloud-gateway-2/src/main/java/com/baeldung/springcloudgateway/ipaddress/IpAddressApplication.java similarity index 100% rename from spring-cloud-modules/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/ipaddress/IpAddressApplication.java rename to spring-cloud-modules/spring-cloud-gateway-2/src/main/java/com/baeldung/springcloudgateway/ipaddress/IpAddressApplication.java diff --git a/spring-cloud-modules/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/ipaddress/ProxiedClientAddressResolver.java b/spring-cloud-modules/spring-cloud-gateway-2/src/main/java/com/baeldung/springcloudgateway/ipaddress/ProxiedClientAddressResolver.java similarity index 100% rename from spring-cloud-modules/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/ipaddress/ProxiedClientAddressResolver.java rename to spring-cloud-modules/spring-cloud-gateway-2/src/main/java/com/baeldung/springcloudgateway/ipaddress/ProxiedClientAddressResolver.java diff --git a/spring-cloud-modules/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/ipaddress/SimpleClientAddressResolver.java b/spring-cloud-modules/spring-cloud-gateway-2/src/main/java/com/baeldung/springcloudgateway/ipaddress/SimpleClientAddressResolver.java similarity index 100% rename from spring-cloud-modules/spring-cloud-gateway/src/main/java/com/baeldung/springcloudgateway/ipaddress/SimpleClientAddressResolver.java rename to spring-cloud-modules/spring-cloud-gateway-2/src/main/java/com/baeldung/springcloudgateway/ipaddress/SimpleClientAddressResolver.java diff --git a/spring-cloud-modules/spring-cloud-gateway/src/main/resources/ipaddress-application.properties b/spring-cloud-modules/spring-cloud-gateway-2/src/main/resources/ipaddress-application.properties similarity index 100% rename from spring-cloud-modules/spring-cloud-gateway/src/main/resources/ipaddress-application.properties rename to spring-cloud-modules/spring-cloud-gateway-2/src/main/resources/ipaddress-application.properties diff --git a/spring-cloud-modules/spring-cloud-gateway/README.md b/spring-cloud-modules/spring-cloud-gateway/README.md index 3d6d70f8a2..80315040c9 100644 --- a/spring-cloud-modules/spring-cloud-gateway/README.md +++ b/spring-cloud-modules/spring-cloud-gateway/README.md @@ -11,4 +11,3 @@ This module contains articles about Spring Cloud Gateway - [Using Spring Cloud Gateway with OAuth 2.0 Patterns](https://www.baeldung.com/spring-cloud-gateway-oauth2) - [URL Rewriting With Spring Cloud Gateway](https://www.baeldung.com/spring-cloud-gateway-url-rewriting) - [Processing the Response Body in Spring Cloud Gateway](https://www.baeldung.com/spring-cloud-gateway-response-body) -- [Rate Limiting With Client IP in Spring Cloud Gateway](https://www.baeldung.com/spring-cloud-gateway-rate-limit-by-client-ip)