Merge pull request #5750 from eugenp/revert-boot-upgrade
revert boot 2.1 upgrade
This commit is contained in:
commit
80566a89cc
|
@ -77,7 +77,8 @@
|
||||||
<rest-assured.version>3.1.0</rest-assured.version>
|
<rest-assured.version>3.1.0</rest-assured.version>
|
||||||
<!-- plugins -->
|
<!-- plugins -->
|
||||||
<thin.version>1.0.11.RELEASE</thin.version>
|
<thin.version>1.0.11.RELEASE</thin.version>
|
||||||
<spring-boot.version>2.1.0.RELEASE</spring-boot.version>
|
<spring-boot.version>2.0.5.RELEASE</spring-boot.version>
|
||||||
<oauth-auto.version>2.1.0.RELEASE</oauth-auto.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ import org.springframework.http.server.reactive.HttpHandler;
|
||||||
import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter;
|
import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter;
|
||||||
import org.springframework.web.reactive.config.EnableWebFlux;
|
import org.springframework.web.reactive.config.EnableWebFlux;
|
||||||
import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
|
import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
|
||||||
import reactor.netty.DisposableServer;
|
import reactor.ipc.netty.NettyContext;
|
||||||
import reactor.netty.http.server.HttpServer;
|
import reactor.ipc.netty.http.server.HttpServer;
|
||||||
|
|
||||||
@ComponentScan(basePackages = {"com.baeldung.reactive.security"})
|
@ComponentScan(basePackages = {"com.baeldung.reactive.security"})
|
||||||
@EnableWebFlux
|
@EnableWebFlux
|
||||||
|
@ -18,16 +18,17 @@ public class SpringSecurity5Application {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try (AnnotationConfigApplicationContext context =
|
try (AnnotationConfigApplicationContext context =
|
||||||
new AnnotationConfigApplicationContext(SpringSecurity5Application.class)) {
|
new AnnotationConfigApplicationContext(SpringSecurity5Application.class)) {
|
||||||
context.getBean(DisposableServer.class).onDispose().block();
|
context.getBean(NettyContext.class).onClose().block();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public DisposableServer nettyContext(ApplicationContext context) {
|
public NettyContext nettyContext(ApplicationContext context) {
|
||||||
HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context)
|
HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context)
|
||||||
.build();
|
.build();
|
||||||
ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@ import org.springframework.web.reactive.function.server.RouterFunctions;
|
||||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
import reactor.netty.DisposableServer;
|
import reactor.ipc.netty.NettyContext;
|
||||||
import reactor.netty.http.server.HttpServer;
|
import reactor.ipc.netty.http.server.HttpServer;
|
||||||
|
|
||||||
import java.time.Duration;
|
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;
|
import static org.springframework.web.reactive.function.server.RequestPredicates.POST;
|
||||||
|
|
||||||
public class Spring5ReactiveServerClientIntegrationTest {
|
public class Spring5ReactiveServerClientIntegrationTest {
|
||||||
private static DisposableServer nettyServer;
|
private static NettyContext nettyContext;
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void setUp() throws Exception {
|
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()
|
RouterFunction<?> route = RouterFunctions.route(POST("/task/process"), request -> ServerResponse.ok()
|
||||||
.body(request.bodyToFlux(Task.class)
|
.body(request.bodyToFlux(Task.class)
|
||||||
.map(ll -> new Task("TaskName", 1)), 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)));
|
.body(Mono.just("server is alive"), String.class)));
|
||||||
HttpHandler httpHandler = RouterFunctions.toHttpHandler(route);
|
HttpHandler httpHandler = RouterFunctions.toHttpHandler(route);
|
||||||
ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler);
|
ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler);
|
||||||
nettyServer = server.handle(adapter).bind().block();
|
nettyContext = server.newHandler(adapter)
|
||||||
|
.block();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
public static void shutDown() {
|
public static void shutDown() {
|
||||||
nettyServer.dispose();
|
nettyContext.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
|
|
|
@ -31,14 +31,14 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.thymeleaf.extras</groupId>
|
<groupId>org.thymeleaf.extras</groupId>
|
||||||
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
|
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- oauth2 -->
|
<!-- oauth2 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.security.oauth.boot</groupId>
|
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||||
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||||
<version>${oauth-auto.version}</version>
|
<version>2.0.1.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
|
|
|
@ -42,4 +42,8 @@
|
||||||
<finalName>${project.artifactId}</finalName>
|
<finalName>${project.artifactId}</finalName>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<spring-boot.version>2.1.0.RELEASE</spring-boot.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -58,9 +58,9 @@ public class TestRestTemplateBasicLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenRestTemplateWrapperWithCredentials_whenSendGetForEntity_thenStatusOk() {
|
public void givenRestTemplateWrapperWithCredentials_whenSendGetForEntity_thenStatusOk() {
|
||||||
RestTemplateBuilder restTemplateBuilder = new RestTemplateBuilder().basicAuthentication("user", "passwd");
|
RestTemplateBuilder restTemplateBuilder = new RestTemplateBuilder();
|
||||||
restTemplateBuilder.configure(restTemplate);
|
restTemplateBuilder.configure(restTemplate);
|
||||||
TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplateBuilder);
|
TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplateBuilder, "user", "passwd");
|
||||||
ResponseEntity<String> response = testRestTemplate.getForEntity(URL_SECURED_BY_AUTHENTICATION,
|
ResponseEntity<String> response = testRestTemplate.getForEntity(URL_SECURED_BY_AUTHENTICATION,
|
||||||
String.class);
|
String.class);
|
||||||
assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
|
assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.thymeleaf.extras</groupId>
|
<groupId>org.thymeleaf.extras</groupId>
|
||||||
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
|
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<rest-assured.version>3.1.0</rest-assured.version>
|
<rest-assured.version>3.1.0</rest-assured.version>
|
||||||
|
<oauth.version>2.3.3.RELEASE</oauth.version>
|
||||||
|
<oauth-auto.version>2.0.1.RELEASE</oauth-auto.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.security.oauth.boot</groupId>
|
<groupId>org.springframework.security.oauth</groupId>
|
||||||
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
<artifactId>spring-security-oauth2</artifactId>
|
||||||
<version>${oauth-auto.version}</version>
|
<version>${oauth.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -37,9 +37,9 @@
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.thymeleaf.extras</groupId>
|
<groupId>org.thymeleaf.extras</groupId>
|
||||||
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
|
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -38,9 +38,9 @@
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.thymeleaf.extras</groupId>
|
<groupId>org.thymeleaf.extras</groupId>
|
||||||
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
|
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.thymeleaf.extras</groupId>
|
<groupId>org.thymeleaf.extras</groupId>
|
||||||
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
|
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue