rearranged packages to include service and secondservice into gateway customfilters package, as they belong to that article
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.springcloudgateway.customfilters;
|
||||
package com.baeldung.springcloudgateway.customfilters.gatewayapp;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.config;
|
||||
package com.baeldung.springcloudgateway.customfilters.gatewayapp.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.filters.factories;
|
||||
package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.filters.factories;
|
||||
package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.filters.factories;
|
||||
package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.filters.factories;
|
||||
package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.filters.global;
|
||||
package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.global;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.filters.global;
|
||||
package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.global;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.filters.global;
|
||||
package com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.global;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.routes;
|
||||
package com.baeldung.springcloudgateway.customfilters.gatewayapp.routes;
|
||||
|
||||
import org.springframework.cloud.gateway.route.RouteLocator;
|
||||
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import com.baeldung.springcloudgateway.customfilters.filters.factories.LoggingGatewayFilterFactory;
|
||||
import com.baeldung.springcloudgateway.customfilters.filters.factories.LoggingGatewayFilterFactory.Config;
|
||||
import com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories.LoggingGatewayFilterFactory;
|
||||
import com.baeldung.springcloudgateway.customfilters.gatewayapp.filters.factories.LoggingGatewayFilterFactory.Config;
|
||||
|
||||
/**
|
||||
* Note: We want to keep this as an example of configuring a Route with a custom filter
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.secondservice;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@PropertySource("classpath:secondservice-application.properties")
|
||||
public class SecondServiceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SecondServiceApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.secondservice.web;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@RestController
|
||||
public class SecondServiceRestController {
|
||||
|
||||
@GetMapping("/resource/language")
|
||||
public Mono<ResponseEntity<String>> getResource() {
|
||||
return Mono.just(ResponseEntity.ok()
|
||||
.body("es"));
|
||||
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.service;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@PropertySource("classpath:service-application.properties")
|
||||
public class ServiceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ServiceApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.baeldung.springcloudgateway.customfilters.service.web;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@RestController
|
||||
public class ServiceRestController {
|
||||
|
||||
@GetMapping("/resource")
|
||||
public Mono<ResponseEntity<String>> getResource() {
|
||||
return Mono.just(ResponseEntity.ok()
|
||||
.header(HttpHeaders.CONTENT_LANGUAGE, Locale.ENGLISH.getLanguage())
|
||||
.body("Service Resource"));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user