BAEL-2302 UPDATED Spring Data REST HTTP Method customization example (#5594)
* BAEL-2302 Spring Data REST HTTP Method customization example * BAEL-2302 Spring Data REST - granular HTTP Methods control * BAEL-2302 Spring Data REST - fixed parent pom file version error * BAEL-2302 Fixing thymeleaf dependencies * BAEL-2302 Spring Data REST - fixed netty bootstrap * BAEL-2302 Spring Data REST - fixed netty test * BAEL-2302 Spring Data REST - fixed spring security oauth2 * BAEL-2302 - Fix oauth2 server deps
This commit is contained in:
+7
-11
@@ -1,5 +1,6 @@
|
||||
package com.baeldung.reactive;
|
||||
|
||||
import com.baeldung.web.reactive.Task;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.springframework.http.server.reactive.HttpHandler;
|
||||
@@ -7,13 +8,10 @@ import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter;
|
||||
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.web.reactive.Task;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.ipc.netty.NettyContext;
|
||||
import reactor.ipc.netty.http.server.HttpServer;
|
||||
import reactor.netty.DisposableServer;
|
||||
import reactor.netty.http.server.HttpServer;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@@ -21,12 +19,11 @@ import static org.springframework.web.reactive.function.server.RequestPredicates
|
||||
import static org.springframework.web.reactive.function.server.RequestPredicates.POST;
|
||||
|
||||
public class Spring5ReactiveServerClientIntegrationTest {
|
||||
|
||||
private static NettyContext nettyContext;
|
||||
private static DisposableServer nettyServer;
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() throws Exception {
|
||||
HttpServer server = HttpServer.create("localhost", 8080);
|
||||
HttpServer server = HttpServer.create().host("localhost").port(8080);
|
||||
RouterFunction<?> route = RouterFunctions.route(POST("/task/process"), request -> ServerResponse.ok()
|
||||
.body(request.bodyToFlux(Task.class)
|
||||
.map(ll -> new Task("TaskName", 1)), Task.class))
|
||||
@@ -34,13 +31,12 @@ public class Spring5ReactiveServerClientIntegrationTest {
|
||||
.body(Mono.just("server is alive"), String.class)));
|
||||
HttpHandler httpHandler = RouterFunctions.toHttpHandler(route);
|
||||
ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler);
|
||||
nettyContext = server.newHandler(adapter)
|
||||
.block();
|
||||
nettyServer = server.handle(adapter).bind().block();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void shutDown() {
|
||||
nettyContext.dispose();
|
||||
nettyServer.dispose();
|
||||
}
|
||||
|
||||
// @Test
|
||||
|
||||
Reference in New Issue
Block a user