Merge pull request #11581 from chaos2418/JAVA-3060
JAVA-3060: adding new spring-reactive module for the ebook.
This commit is contained in:
@@ -557,7 +557,6 @@
|
||||
<module>atomikos</module>
|
||||
<module>reactive-systems</module>
|
||||
<module>slack</module>
|
||||
<module>spring-webflux-threads</module>
|
||||
</modules>
|
||||
|
||||
</profile>
|
||||
@@ -620,6 +619,7 @@
|
||||
<module>spring-5-reactive-security</module>
|
||||
<module>spring-5-webflux</module>
|
||||
<module>spring-5-webflux-2</module>
|
||||
<module>spring-reactive</module>
|
||||
|
||||
<module>spring-activiti</module>
|
||||
<module>spring-akka</module>
|
||||
@@ -1039,7 +1039,6 @@
|
||||
<module>atomikos</module>
|
||||
<module>reactive-systems</module>
|
||||
<module>slack</module>
|
||||
<module>spring-webflux-threads</module>
|
||||
</modules>
|
||||
|
||||
</profile>
|
||||
@@ -1093,6 +1092,7 @@
|
||||
<module>spring-5-reactive-oauth</module>
|
||||
<module>spring-5-reactive-security</module>
|
||||
<module>spring-5-webflux</module>
|
||||
<module>spring-reactive</module>
|
||||
|
||||
<module>spring-activiti</module>
|
||||
<module>spring-akka</module>
|
||||
|
||||
@@ -4,7 +4,6 @@ This module contains articles about Reactor Core.
|
||||
|
||||
### Relevant articles
|
||||
|
||||
- [Intro To Reactor Core](https://www.baeldung.com/reactor-core)
|
||||
- [Combining Publishers in Project Reactor](https://www.baeldung.com/reactor-combine-streams)
|
||||
- [Programmatically Creating Sequences with Project Reactor](https://www.baeldung.com/flux-sequences-reactor)
|
||||
- [How to Extract a Mono’s Content in Java](https://www.baeldung.com/java-string-from-mono)
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
This module contains articles about reactive Spring 5.
|
||||
|
||||
- [Spring WebClient vs. RestTemplate](https://www.baeldung.com/spring-webclient-resttemplate)
|
||||
- [Validation for Functional Endpoints in Spring 5](https://www.baeldung.com/spring-functional-endpoints-validation)
|
||||
- [Testing Reactive Streams Using StepVerifier and TestPublisher](https://www.baeldung.com/reactive-streams-step-verifier-test-publisher)
|
||||
- [Debugging Reactive Streams in Java](https://www.baeldung.com/spring-debugging-reactive-streams)
|
||||
- [Static Content in Spring WebFlux](https://www.baeldung.com/spring-webflux-static-content)
|
||||
- [Server-Sent Events in Spring](https://www.baeldung.com/spring-server-sent-events)
|
||||
- [Backpressure Mechanism in Spring WebFlux](https://www.baeldung.com/spring-webflux-backpressure)
|
||||
|
||||
@@ -8,8 +8,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
||||
### Relevant Articles
|
||||
|
||||
- [Spring Boot Actuator](https://www.baeldung.com/spring-boot-actuators)
|
||||
- [Spring Security 5 for Reactive Applications](https://www.baeldung.com/spring-security-5-reactive)
|
||||
- [Guide to Spring 5 WebFlux](https://www.baeldung.com/spring-webflux)
|
||||
- [Introduction to the Functional Web Framework in Spring 5](https://www.baeldung.com/spring-5-functional-web)
|
||||
- [Guide to the AuthenticationManagerResolver in Spring Security](https://www.baeldung.com/spring-security-authenticationmanagerresolver)
|
||||
- [Spring Webflux and CORS](https://www.baeldung.com/spring-webflux-cors)
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>com.baeldung.webflux.EmployeeSpringApplication</mainClass>
|
||||
<mainClass>com.baeldung.reactive.actuator.Spring5ReactiveApplication</mainClass>
|
||||
<layout>JAR</layout>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.baeldung.webflux;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public class EmployeeRepository {
|
||||
|
||||
static Map<String,Employee> employeeData;
|
||||
|
||||
static Map<String,String> employeeAccessData;
|
||||
|
||||
static
|
||||
{
|
||||
employeeData = new HashMap<>();
|
||||
employeeData.put("1",new Employee("1","Employee 1"));
|
||||
employeeData.put("2",new Employee("2","Employee 2"));
|
||||
employeeData.put("3",new Employee("3","Employee 3"));
|
||||
employeeData.put("4",new Employee("4","Employee 4"));
|
||||
employeeData.put("5",new Employee("5","Employee 5"));
|
||||
employeeData.put("6",new Employee("6","Employee 6"));
|
||||
employeeData.put("7",new Employee("7","Employee 7"));
|
||||
employeeData.put("8",new Employee("8","Employee 8"));
|
||||
employeeData.put("9",new Employee("9","Employee 9"));
|
||||
employeeData.put("10",new Employee("10","Employee 10"));
|
||||
|
||||
employeeAccessData=new HashMap<>();
|
||||
employeeAccessData.put("1", "Employee 1 Access Key");
|
||||
employeeAccessData.put("2", "Employee 2 Access Key");
|
||||
employeeAccessData.put("3", "Employee 3 Access Key");
|
||||
employeeAccessData.put("4", "Employee 4 Access Key");
|
||||
employeeAccessData.put("5", "Employee 5 Access Key");
|
||||
employeeAccessData.put("6", "Employee 6 Access Key");
|
||||
employeeAccessData.put("7", "Employee 7 Access Key");
|
||||
employeeAccessData.put("8", "Employee 8 Access Key");
|
||||
employeeAccessData.put("9", "Employee 9 Access Key");
|
||||
employeeAccessData.put("10", "Employee 10 Access Key");
|
||||
}
|
||||
|
||||
public Mono<Employee> findEmployeeById(String id)
|
||||
{
|
||||
return Mono.just(employeeData.get(id));
|
||||
}
|
||||
|
||||
public Flux<Employee> findAllEmployees()
|
||||
{
|
||||
return Flux.fromIterable(employeeData.values());
|
||||
}
|
||||
|
||||
public Mono<Employee> updateEmployee(Employee employee)
|
||||
{
|
||||
Employee existingEmployee=employeeData.get(employee.getId());
|
||||
if(existingEmployee!=null)
|
||||
{
|
||||
existingEmployee.setName(employee.getName());
|
||||
}
|
||||
return Mono.just(existingEmployee);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.baeldung;
|
||||
|
||||
import com.baeldung.reactive.actuator.Spring5ReactiveApplication;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.reactive.security.SpringSecurity5Application;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SpringSecurity5Application.class)
|
||||
@SpringBootTest(classes = Spring5ReactiveApplication.class)
|
||||
public class SpringContextTest {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -7,11 +7,9 @@ The "REST With Spring" Classes: https://bit.ly/restwithspring
|
||||
|
||||
### Relevant Articles
|
||||
|
||||
- [Spring 5 WebClient](https://www.baeldung.com/spring-5-webclient)
|
||||
- [Exploring the Spring 5 WebFlux URL Matching](https://www.baeldung.com/spring-5-mvc-url-matching)
|
||||
- [Reactive WebSockets with Spring 5](https://www.baeldung.com/spring-5-reactive-websockets)
|
||||
- [Spring Webflux Filters](https://www.baeldung.com/spring-webflux-filters)
|
||||
- [How to Set a Header on a Response with Spring 5](https://www.baeldung.com/spring-response-header)
|
||||
- [Handling Errors in Spring WebFlux](https://www.baeldung.com/spring-webflux-errors)
|
||||
- [A Guide to Spring Session Reactive Support: WebSession](https://www.baeldung.com/spring-session-reactive)
|
||||
- More articles: [[next -->]](/spring-5-reactive-2)
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.baeldung.web.reactive;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class Task {
|
||||
|
||||
private final String name;
|
||||
|
||||
private final int id;
|
||||
|
||||
public Task(@JsonProperty("name") String name, @JsonProperty("id") int id) {
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Task{" + "name='" + name + '\'' + ", id=" + id + '}';
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ This module contains articles about Spring 5 WebFlux
|
||||
|
||||
- [Spring Boot Reactor Netty Configuration](https://www.baeldung.com/spring-boot-reactor-netty)
|
||||
- [How to Return 404 with Spring WebFlux](https://www.baeldung.com/spring-webflux-404)
|
||||
- [Spring WebClient Requests with Parameters](https://www.baeldung.com/webflux-webclient-parameters)
|
||||
- [RSocket Using Spring Boot](https://www.baeldung.com/spring-boot-rsocket)
|
||||
- [Spring MVC Async vs Spring WebFlux](https://www.baeldung.com/spring-mvc-async-vs-webflux)
|
||||
- [Set a Timeout in Spring 5 Webflux WebClient](https://www.baeldung.com/spring-webflux-timeout)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
## Spring Reactive
|
||||
|
||||
This module contains articles describing reactive processing in Spring.
|
||||
|
||||
## Relevant articles:
|
||||
|
||||
- [Intro To Reactor Core](https://www.baeldung.com/reactor-core)
|
||||
- [Debugging Reactive Streams in Java](https://www.baeldung.com/spring-debugging-reactive-streams)
|
||||
- [Guide to Spring 5 WebFlux](https://www.baeldung.com/spring-webflux)
|
||||
- [Introduction to the Functional Web Framework in Spring 5](https://www.baeldung.com/spring-5-functional-web)
|
||||
- [Spring 5 WebClient](https://www.baeldung.com/spring-5-webclient)
|
||||
- [Spring WebClient vs. RestTemplate](https://www.baeldung.com/spring-webclient-resttemplate)
|
||||
- [Spring WebClient Requests with Parameters](https://www.baeldung.com/webflux-webclient-parameters)
|
||||
- [Handling Errors in Spring WebFlux](https://www.baeldung.com/spring-webflux-errors)
|
||||
- [Spring Security 5 for Reactive Applications](https://www.baeldung.com/spring-security-5-reactive)
|
||||
- [Concurrency in Spring WebFlux](https://www.baeldung.com/spring-webflux-concurrency)
|
||||
@@ -0,0 +1,103 @@
|
||||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>spring-reactive</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.reactivex.rxjava2</groupId>
|
||||
<artifactId>rxjava</artifactId>
|
||||
<version>${rxjava.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.projectreactor.kafka</groupId>
|
||||
<artifactId>reactor-kafka</artifactId>
|
||||
<version>${reactor-kafka.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.projectreactor</groupId>
|
||||
<artifactId>reactor-test</artifactId>
|
||||
<version>${reactor.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>integration-lite-first</id>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<logback.configurationFile>${project.basedir}/src/test/resources/logback-test.xml</logback.configurationFile>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>integration-lite-second</id>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<logback.configurationFile>${project.basedir}/src/test/resources/logback-test.xml</logback.configurationFile>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<properties>
|
||||
<reactor.version>3.4.12</reactor.version>
|
||||
<reactor-kafka.version>1.2.2.RELEASE</reactor-kafka.version>
|
||||
<rxjava.version>2.2.19</rxjava.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.webflux;
|
||||
package com.baeldung.reactive.concurrency;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
+9
-10
@@ -1,12 +1,6 @@
|
||||
package com.baeldung.webflux;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
package com.baeldung.reactive.concurrency;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
@@ -21,8 +15,6 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.core.scheduler.Scheduler;
|
||||
@@ -34,6 +26,13 @@ import reactor.kafka.sender.KafkaSender;
|
||||
import reactor.kafka.sender.SenderOptions;
|
||||
import reactor.kafka.sender.SenderRecord;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/")
|
||||
public class Controller {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.webflux;
|
||||
package com.baeldung.reactive.concurrency;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.webflux;
|
||||
package com.baeldung.reactive.concurrency;
|
||||
|
||||
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
|
||||
|
||||
+3
-4
@@ -1,6 +1,4 @@
|
||||
package com.baeldung.debugging.consumer;
|
||||
|
||||
import java.util.Collections;
|
||||
package com.baeldung.reactive.debugging.consumer;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -9,9 +7,10 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.security.config.web.server.ServerHttpSecurity;
|
||||
import org.springframework.security.web.server.SecurityWebFilterChain;
|
||||
|
||||
import reactor.core.publisher.Hooks;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@SpringBootApplication(exclude = MongoReactiveAutoConfiguration.class)
|
||||
@EnableScheduling
|
||||
public class ConsumerDebuggingApplication {
|
||||
+7
-9
@@ -1,8 +1,8 @@
|
||||
package com.baeldung.debugging.consumer.chronjobs;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
package com.baeldung.reactive.debugging.consumer.chronjobs;
|
||||
|
||||
import com.baeldung.reactive.debugging.consumer.model.Foo;
|
||||
import com.baeldung.reactive.debugging.consumer.model.FooDto;
|
||||
import com.baeldung.reactive.debugging.consumer.service.FooService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -10,13 +10,11 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import com.baeldung.debugging.consumer.model.Foo;
|
||||
import com.baeldung.debugging.consumer.model.FooDto;
|
||||
import com.baeldung.debugging.consumer.service.FooService;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@Component
|
||||
public class ChronJobs {
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
package com.baeldung.debugging.consumer.controllers;
|
||||
package com.baeldung.reactive.debugging.consumer.controllers;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import reactor.core.publisher.Hooks;
|
||||
|
||||
@RestController
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
package com.baeldung.debugging.consumer.model;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
package com.baeldung.reactive.debugging.consumer.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.debugging.consumer.model;
|
||||
package com.baeldung.reactive.debugging.consumer.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
+4
-5
@@ -1,11 +1,10 @@
|
||||
package com.baeldung.debugging.consumer.service;
|
||||
package com.baeldung.reactive.debugging.consumer.service;
|
||||
|
||||
import com.baeldung.reactive.debugging.consumer.model.Foo;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import com.baeldung.debugging.consumer.model.Foo;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
public class FooNameHelper {
|
||||
|
||||
public static Flux<Foo> concatAndSubstringFooName(Flux<Foo> flux) {
|
||||
+4
-5
@@ -1,11 +1,10 @@
|
||||
package com.baeldung.debugging.consumer.service;
|
||||
package com.baeldung.reactive.debugging.consumer.service;
|
||||
|
||||
import com.baeldung.reactive.debugging.consumer.model.Foo;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import com.baeldung.debugging.consumer.model.Foo;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
public class FooQuantityHelper {
|
||||
|
||||
public static Flux<Foo> processFooReducingQuantity(Flux<Foo> flux) {
|
||||
+2
-4
@@ -1,10 +1,8 @@
|
||||
package com.baeldung.debugging.consumer.service;
|
||||
package com.baeldung.reactive.debugging.consumer.service;
|
||||
|
||||
import com.baeldung.reactive.debugging.consumer.model.Foo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.baeldung.debugging.consumer.model.Foo;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
public class FooReporter {
|
||||
+8
-10
@@ -1,20 +1,18 @@
|
||||
package com.baeldung.debugging.consumer.service;
|
||||
|
||||
import static com.baeldung.debugging.consumer.service.FooNameHelper.concatAndSubstringFooName;
|
||||
import static com.baeldung.debugging.consumer.service.FooNameHelper.substringFooName;
|
||||
import static com.baeldung.debugging.consumer.service.FooQuantityHelper.divideFooQuantity;
|
||||
import static com.baeldung.debugging.consumer.service.FooQuantityHelper.processFooReducingQuantity;
|
||||
import static com.baeldung.debugging.consumer.service.FooReporter.reportResult;
|
||||
package com.baeldung.reactive.debugging.consumer.service;
|
||||
|
||||
import com.baeldung.reactive.debugging.consumer.model.Foo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.baeldung.debugging.consumer.model.Foo;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.scheduler.Schedulers;
|
||||
|
||||
import static com.baeldung.reactive.debugging.consumer.service.FooNameHelper.concatAndSubstringFooName;
|
||||
import static com.baeldung.reactive.debugging.consumer.service.FooNameHelper.substringFooName;
|
||||
import static com.baeldung.reactive.debugging.consumer.service.FooQuantityHelper.divideFooQuantity;
|
||||
import static com.baeldung.reactive.debugging.consumer.service.FooQuantityHelper.processFooReducingQuantity;
|
||||
import static com.baeldung.reactive.debugging.consumer.service.FooReporter.reportResult;
|
||||
|
||||
@Component
|
||||
public class FooService {
|
||||
|
||||
+3
-3
@@ -1,6 +1,4 @@
|
||||
package com.baeldung.debugging.server;
|
||||
|
||||
import java.util.Collections;
|
||||
package com.baeldung.reactive.debugging.server;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -9,6 +7,8 @@ import org.springframework.security.config.web.server.ServerHttpSecurity;
|
||||
import org.springframework.security.web.server.SecurityWebFilterChain;
|
||||
import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@EnableWebFlux
|
||||
@SpringBootApplication
|
||||
public class ServerDebuggingApplication {
|
||||
+5
-7
@@ -1,20 +1,18 @@
|
||||
package com.baeldung.debugging.server.handlers;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
package com.baeldung.reactive.debugging.server.handlers;
|
||||
|
||||
import com.baeldung.reactive.debugging.server.model.Foo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
|
||||
import com.baeldung.debugging.server.model.Foo;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
@Component
|
||||
public class ServerHandler {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.debugging.server.model;
|
||||
package com.baeldung.reactive.debugging.server.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+2
-3
@@ -1,5 +1,6 @@
|
||||
package com.baeldung.debugging.server.routers;
|
||||
package com.baeldung.reactive.debugging.server.routers;
|
||||
|
||||
import com.baeldung.reactive.debugging.server.handlers.ServerHandler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -8,8 +9,6 @@ import org.springframework.web.reactive.function.server.RouterFunction;
|
||||
import org.springframework.web.reactive.function.server.RouterFunctions;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
|
||||
import com.baeldung.debugging.server.handlers.ServerHandler;
|
||||
|
||||
@Configuration
|
||||
public class ServerRouter {
|
||||
|
||||
+8
-7
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.webclient;
|
||||
package com.baeldung.reactive.errorhandling;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -7,16 +7,17 @@ import org.springframework.security.config.web.server.ServerHttpSecurity;
|
||||
import org.springframework.security.web.server.SecurityWebFilterChain;
|
||||
|
||||
@SpringBootApplication
|
||||
public class WebClientApplication {
|
||||
public class ErrorHandlingApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(WebClientApplication.class, args);
|
||||
SpringApplication.run(ErrorHandlingApplication.class, args);
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public SecurityWebFilterChain functionalValidationsSpringSecurityFilterChain(ServerHttpSecurity http) {
|
||||
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
|
||||
http.authorizeExchange()
|
||||
.anyExchange()
|
||||
.permitAll();
|
||||
.anyExchange()
|
||||
.permitAll();
|
||||
http.csrf().disable();
|
||||
return http.build();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user