JAVA-29183 :- Upgrade spring-5-webflux & spring-5-webflux-2 to Spring Boot 3. (#16149)
Co-authored-by: Amit Pandey <amitpandey@cloud.upwork.com>
This commit is contained in:
parent
ff723063a7
commit
25217a11bd
|
@ -10,30 +10,11 @@
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-boot-2</artifactId>
|
<artifactId>parent-boot-3</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<relativePath>../parent-boot-2</relativePath>
|
<relativePath>../parent-boot-3</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit</groupId>
|
|
||||||
<artifactId>junit-bom</artifactId>
|
|
||||||
<version>${junit-jupiter.version}</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
|
||||||
<version>${spring-boot.version}</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -110,14 +91,6 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>16</source>
|
|
||||||
<target>16</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
@ -126,6 +99,9 @@
|
||||||
<caffeine.version>3.1.8</caffeine.version>
|
<caffeine.version>3.1.8</caffeine.version>
|
||||||
<testcontainers-mongodb.version>1.16.2</testcontainers-mongodb.version>
|
<testcontainers-mongodb.version>1.16.2</testcontainers-mongodb.version>
|
||||||
<mockwebserver.version>5.0.0-alpha.12</mockwebserver.version>
|
<mockwebserver.version>5.0.0-alpha.12</mockwebserver.version>
|
||||||
|
<spring-boot.repackage.skip>true</spring-boot.repackage.skip>
|
||||||
|
<spring-boot.version>3.2.2</spring-boot.version>
|
||||||
|
<junit-jupiter.version>5.10.2</junit-jupiter.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -1,12 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<appender name="Console"
|
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
class="ch.qos.logback.core.ConsoleAppender">
|
<encoder>
|
||||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg %kvp%n</pattern>
|
||||||
<Pattern>
|
</encoder>
|
||||||
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
|
|
||||||
</Pattern>
|
|
||||||
</layout>
|
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<appender name="AccessLog" class="ch.qos.logback.core.FileAppender">
|
<appender name="AccessLog" class="ch.qos.logback.core.FileAppender">
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
|
||||||
<Pattern>
|
|
||||||
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
|
|
||||||
</Pattern>
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
<root level="info">
|
<root level="info">
|
||||||
<appender-ref ref="Console"/>
|
<appender-ref ref="Console"/>
|
||||||
</root>
|
</root>
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-boot-2</artifactId>
|
<artifactId>parent-boot-3</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<relativePath>../parent-boot-2</relativePath>
|
<relativePath>../parent-boot-3</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
@ -90,12 +90,22 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<parameters>true</parameters>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<mockwebserver.version>5.0.0-alpha.12</mockwebserver.version>
|
<mockwebserver.version>5.0.0-alpha.12</mockwebserver.version>
|
||||||
<kotlin-stdlib.version>2.0.0-Beta4</kotlin-stdlib.version>
|
<kotlin-stdlib.version>2.0.0-Beta4</kotlin-stdlib.version>
|
||||||
|
<spring-boot.repackage.skip>true</spring-boot.repackage.skip>
|
||||||
|
<spring-boot.version>3.2.2</spring-boot.version>
|
||||||
|
<junit-jupiter.version>5.10.2</junit-jupiter.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -18,18 +18,18 @@ import static org.springframework.web.reactive.function.server.RequestPredicates
|
||||||
@RestController
|
@RestController
|
||||||
public class ResponseStatusController {
|
public class ResponseStatusController {
|
||||||
|
|
||||||
@GetMapping(value = "/ok", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
@GetMapping(value = "/ok", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public Flux<String> ok() {
|
public Flux<String> ok() {
|
||||||
return Flux.just("ok");
|
return Flux.just("ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/no-content", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
@GetMapping(value = "/no-content", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||||
public Flux<String> noContent() {
|
public Flux<String> noContent() {
|
||||||
return Flux.empty();
|
return Flux.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/accepted", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
|
@GetMapping(value = "/accepted", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public Flux<String> accepted(ServerHttpResponse response) {
|
public Flux<String> accepted(ServerHttpResponse response) {
|
||||||
response.setStatusCode(HttpStatus.ACCEPTED);
|
response.setStatusCode(HttpStatus.ACCEPTED);
|
||||||
return Flux.just("accepted");
|
return Flux.just("accepted");
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.baeldung.spring.retry;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.HttpStatusCode;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.reactive.function.client.WebClient;
|
import org.springframework.web.reactive.function.client.WebClient;
|
||||||
|
@ -24,7 +25,7 @@ public class ExternalConnector {
|
||||||
.uri(PATH_BY_ID, stockId)
|
.uri(PATH_BY_ID, stockId)
|
||||||
.accept(MediaType.APPLICATION_JSON)
|
.accept(MediaType.APPLICATION_JSON)
|
||||||
.retrieve()
|
.retrieve()
|
||||||
.onStatus(HttpStatus::is5xxServerError, response -> Mono.error(new ServiceException("Server error", response.rawStatusCode())))
|
.onStatus(HttpStatusCode::is5xxServerError, response -> Mono.error(new ServiceException("Server error", response.statusCode().value())))
|
||||||
.bodyToMono(String.class)
|
.bodyToMono(String.class)
|
||||||
.retryWhen(Retry.backoff(3, Duration.ofSeconds(2))
|
.retryWhen(Retry.backoff(3, Duration.ofSeconds(2))
|
||||||
.filter(throwable -> throwable instanceof ServiceException)
|
.filter(throwable -> throwable instanceof ServiceException)
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class NettyWebServerFactorySslCustomizer implements WebServerFactoryCusto
|
||||||
ssl.setKeyStorePassword("secret");
|
ssl.setKeyStorePassword("secret");
|
||||||
Http2 http2 = new Http2();
|
Http2 http2 = new Http2();
|
||||||
http2.setEnabled(false);
|
http2.setEnabled(false);
|
||||||
serverFactory.addServerCustomizers(new SslServerCustomizer(ssl, http2, null));
|
serverFactory.addServerCustomizers(new SslServerCustomizer(http2, ssl.getClientAuth(), null));
|
||||||
serverFactory.setPort(8443);
|
serverFactory.setPort(8443);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class TimeoutController {
|
||||||
@GetMapping("/{timeout}")
|
@GetMapping("/{timeout}")
|
||||||
private Mono<String> timeout(@PathVariable int timeout) {
|
private Mono<String> timeout(@PathVariable int timeout) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(timeout * 1000);
|
Thread.sleep(timeout * 1000L);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<appender name="Console"
|
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
class="ch.qos.logback.core.ConsoleAppender">
|
<encoder>
|
||||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg %kvp%n</pattern>
|
||||||
<Pattern>
|
</encoder>
|
||||||
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
|
|
||||||
</Pattern>
|
|
||||||
</layout>
|
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<appender name="AccessLog" class="ch.qos.logback.core.FileAppender">
|
<appender name="AccessLog" class="ch.qos.logback.core.FileAppender">
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<layout class="ch.qos.logback.classic.PatternLayout">
|
<encoder>
|
||||||
<Pattern>
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg %kvp%n</pattern>
|
||||||
%black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
|
</encoder>
|
||||||
</Pattern>
|
|
||||||
</layout>
|
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<root level="info">
|
<root level="info">
|
||||||
<appender-ref ref="Console"/>
|
<appender-ref ref="Console"/>
|
||||||
</root>
|
</root>
|
||||||
|
|
Loading…
Reference in New Issue