From cf602faff9a5d2971f28c853374cb90066108831 Mon Sep 17 00:00:00 2001 From: Loredana Date: Thu, 22 Nov 2018 00:37:23 +0200 Subject: [PATCH 1/2] revert boot 2.1 upgrade --- parent-boot-2/pom.xml | 5 +++-- .../security/SpringSecurity5Application.java | 11 ++++++----- .../Spring5ReactiveServerClientIntegrationTest.java | 13 +++++++------ spring-5-security/pom.xml | 4 ++-- spring-data-rest/pom.xml | 4 ++++ spring-security-mvc-boot/pom.xml | 2 +- spring-security-sso/pom.xml | 4 +++- .../spring-security-sso-auth-server/pom.xml | 8 ++++---- .../spring-security-sso-ui-2/pom.xml | 4 ++-- spring-security-sso/spring-security-sso-ui/pom.xml | 4 ++-- spring-security-thymeleaf/pom.xml | 2 +- 11 files changed, 35 insertions(+), 26 deletions(-) diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index bb89cb2729..67837e1a4e 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -77,7 +77,8 @@ 3.1.0 1.0.11.RELEASE - 2.1.0.RELEASE - 2.1.0.RELEASE + 2.0.5.RELEASE + + diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java index ba913bc2d7..f2963c4fa5 100644 --- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java @@ -8,8 +8,8 @@ import org.springframework.http.server.reactive.HttpHandler; import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; import org.springframework.web.reactive.config.EnableWebFlux; import org.springframework.web.server.adapter.WebHttpHandlerBuilder; -import reactor.netty.DisposableServer; -import reactor.netty.http.server.HttpServer; +import reactor.ipc.netty.NettyContext; +import reactor.ipc.netty.http.server.HttpServer; @ComponentScan(basePackages = {"com.baeldung.reactive.security"}) @EnableWebFlux @@ -18,16 +18,17 @@ public class SpringSecurity5Application { public static void main(String[] args) { try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringSecurity5Application.class)) { - context.getBean(DisposableServer.class).onDispose().block(); + context.getBean(NettyContext.class).onClose().block(); } } @Bean - public DisposableServer nettyContext(ApplicationContext context) { + public NettyContext nettyContext(ApplicationContext context) { HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context) .build(); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); - return HttpServer.create().host("localhost").port(8080).handle(adapter).bind().block(); + HttpServer httpServer = HttpServer.create("localhost", 8080); + return httpServer.newHandler(adapter).block(); } } diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/Spring5ReactiveServerClientIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/Spring5ReactiveServerClientIntegrationTest.java index 384600994e..5ebfa39358 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/Spring5ReactiveServerClientIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/Spring5ReactiveServerClientIntegrationTest.java @@ -10,8 +10,8 @@ import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.netty.DisposableServer; -import reactor.netty.http.server.HttpServer; +import reactor.ipc.netty.NettyContext; +import reactor.ipc.netty.http.server.HttpServer; import java.time.Duration; @@ -19,11 +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 DisposableServer nettyServer; + private static NettyContext nettyContext; @BeforeAll public static void setUp() throws Exception { - HttpServer server = HttpServer.create().host("localhost").port(8080); + HttpServer server = HttpServer.create("localhost", 8080); RouterFunction route = RouterFunctions.route(POST("/task/process"), request -> ServerResponse.ok() .body(request.bodyToFlux(Task.class) .map(ll -> new Task("TaskName", 1)), Task.class)) @@ -31,12 +31,13 @@ public class Spring5ReactiveServerClientIntegrationTest { .body(Mono.just("server is alive"), String.class))); HttpHandler httpHandler = RouterFunctions.toHttpHandler(route); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler); - nettyServer = server.handle(adapter).bind().block(); + nettyContext = server.newHandler(adapter) + .block(); } @AfterAll public static void shutDown() { - nettyServer.dispose(); + nettyContext.dispose(); } // @Test diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index da62f39fa9..f5fb359896 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -31,14 +31,14 @@ org.thymeleaf.extras - thymeleaf-extras-springsecurity5 + thymeleaf-extras-springsecurity4 org.springframework.security.oauth.boot spring-security-oauth2-autoconfigure - ${oauth-auto.version} + 2.0.1.RELEASE org.springframework.security diff --git a/spring-data-rest/pom.xml b/spring-data-rest/pom.xml index a756ef0497..a6f12e1904 100644 --- a/spring-data-rest/pom.xml +++ b/spring-data-rest/pom.xml @@ -42,4 +42,8 @@ ${project.artifactId} + + 2.1.0.RELEASE + + diff --git a/spring-security-mvc-boot/pom.xml b/spring-security-mvc-boot/pom.xml index 0a40b0b324..2427d0de1a 100644 --- a/spring-security-mvc-boot/pom.xml +++ b/spring-security-mvc-boot/pom.xml @@ -36,7 +36,7 @@ org.thymeleaf.extras - thymeleaf-extras-springsecurity5 + thymeleaf-extras-springsecurity4 org.springframework.boot diff --git a/spring-security-sso/pom.xml b/spring-security-sso/pom.xml index 7761919ca7..6e61da1519 100644 --- a/spring-security-sso/pom.xml +++ b/spring-security-sso/pom.xml @@ -23,6 +23,8 @@ 3.1.0 + 2.3.3.RELEASE + 2.0.1.RELEASE - \ No newline at end of file + diff --git a/spring-security-sso/spring-security-sso-auth-server/pom.xml b/spring-security-sso/spring-security-sso-auth-server/pom.xml index c0ad6dee2e..ff76f377c6 100644 --- a/spring-security-sso/spring-security-sso-auth-server/pom.xml +++ b/spring-security-sso/spring-security-sso-auth-server/pom.xml @@ -20,10 +20,10 @@ - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - ${oauth-auto.version} + org.springframework.security.oauth + spring-security-oauth2 + ${oauth.version} - \ No newline at end of file + diff --git a/spring-security-sso/spring-security-sso-ui-2/pom.xml b/spring-security-sso/spring-security-sso-ui-2/pom.xml index 5881409c3a..1f9a5754ae 100644 --- a/spring-security-sso/spring-security-sso-ui-2/pom.xml +++ b/spring-security-sso/spring-security-sso-ui-2/pom.xml @@ -37,9 +37,9 @@ org.thymeleaf.extras - thymeleaf-extras-springsecurity5 + thymeleaf-extras-springsecurity4 - \ No newline at end of file + diff --git a/spring-security-sso/spring-security-sso-ui/pom.xml b/spring-security-sso/spring-security-sso-ui/pom.xml index 3e85eb4737..56131749ba 100644 --- a/spring-security-sso/spring-security-sso-ui/pom.xml +++ b/spring-security-sso/spring-security-sso-ui/pom.xml @@ -38,9 +38,9 @@ org.thymeleaf.extras - thymeleaf-extras-springsecurity5 + thymeleaf-extras-springsecurity4 - \ No newline at end of file + diff --git a/spring-security-thymeleaf/pom.xml b/spring-security-thymeleaf/pom.xml index d8b476683a..5b7715bdeb 100644 --- a/spring-security-thymeleaf/pom.xml +++ b/spring-security-thymeleaf/pom.xml @@ -43,7 +43,7 @@ org.thymeleaf.extras - thymeleaf-extras-springsecurity5 + thymeleaf-extras-springsecurity4 From d988b1280a2c7d2d31029f3f4f1734dbd78ff511 Mon Sep 17 00:00:00 2001 From: Loredana Date: Thu, 22 Nov 2018 23:59:22 +0200 Subject: [PATCH 2/2] fix test --- .../org/baeldung/client/TestRestTemplateBasicLiveTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-resttemplate/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java b/spring-resttemplate/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java index 03a76aca74..e303c75a28 100644 --- a/spring-resttemplate/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java +++ b/spring-resttemplate/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java @@ -58,9 +58,9 @@ public class TestRestTemplateBasicLiveTest { @Test public void givenRestTemplateWrapperWithCredentials_whenSendGetForEntity_thenStatusOk() { - RestTemplateBuilder restTemplateBuilder = new RestTemplateBuilder().basicAuthentication("user", "passwd"); + RestTemplateBuilder restTemplateBuilder = new RestTemplateBuilder(); restTemplateBuilder.configure(restTemplate); - TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplateBuilder); + TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplateBuilder, "user", "passwd"); ResponseEntity response = testRestTemplate.getForEntity(URL_SECURED_BY_AUTHENTICATION, String.class); assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));