@@ -5,17 +5,11 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
||||
|
||||
### Relevant Articles
|
||||
|
||||
- [Concurrent Test Execution in Spring 5](http://www.baeldung.com/spring-5-concurrent-tests)
|
||||
- [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web)
|
||||
- [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching)
|
||||
- [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient)
|
||||
- [Spring 5 Functional Bean Registration](http://www.baeldung.com/spring-5-functional-beans)
|
||||
- [The SpringJUnitConfig and SpringJUnitWebConfig Annotations in Spring 5](http://www.baeldung.com/spring-5-junit-config)
|
||||
- [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive)
|
||||
- [Spring 5 Testing with @EnabledIf Annotation](https://github.com/eugenp/tutorials/tree/master/spring-5)
|
||||
- [Reactive WebSockets with Spring 5](http://www.baeldung.com/spring-5-reactive-websockets)
|
||||
- [Spring Boot Actuator](http://www.baeldung.com/spring-boot-actuators)
|
||||
- [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching)
|
||||
- [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive)
|
||||
- [Reactive WebSockets with Spring 5](http://www.baeldung.com/spring-5-reactive-websockets)
|
||||
- [Spring Webflux Filters](http://www.baeldung.com/spring-webflux-filters)
|
||||
- [Reactive Flow with MongoDB, Kotlin, and Spring WebFlux](http://www.baeldung.com/kotlin-mongodb-spring-webflux)
|
||||
- [Spring Data Reactive Repositories with MongoDB](http://www.baeldung.com/spring-data-mongodb-reactive)
|
||||
- [How to Set a Header on a Response with Spring 5](http://www.baeldung.com/spring-response-header)
|
||||
|
||||
@@ -127,15 +127,6 @@
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.flapdoodle.embed</groupId>
|
||||
<artifactId>de.flapdoodle.embed.mongo</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.reactivex.rxjava2</groupId>
|
||||
<artifactId>rxjava</artifactId>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.baeldung.functional;
|
||||
|
||||
class Actor {
|
||||
private String firstname;
|
||||
private String lastname;
|
||||
|
||||
public Actor() {
|
||||
}
|
||||
|
||||
public Actor(String firstname, String lastname) {
|
||||
this.firstname = firstname;
|
||||
this.lastname = lastname;
|
||||
}
|
||||
|
||||
public String getFirstname() {
|
||||
return firstname;
|
||||
}
|
||||
|
||||
public String getLastname() {
|
||||
return lastname;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.baeldung.reactive;
|
||||
|
||||
import com.mongodb.reactivestreams.client.MongoClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Spring5ReactiveApplication{
|
||||
@@ -14,12 +12,4 @@ public class Spring5ReactiveApplication{
|
||||
SpringApplication.run(Spring5ReactiveApplication.class, args);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
MongoClient mongoClient;
|
||||
|
||||
@Bean
|
||||
public ReactiveMongoTemplate reactiveMongoTemplate() {
|
||||
return new ReactiveMongoTemplate(mongoClient, "test");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung;
|
||||
package com.baeldung.reactive;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.baeldung.reactive.actuator;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.security.reactive.EndpointRequest;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
|
||||
import org.springframework.security.config.web.server.ServerHttpSecurity;
|
||||
import org.springframework.security.web.server.SecurityWebFilterChain;
|
||||
|
||||
@Configuration
|
||||
@EnableWebFluxSecurity
|
||||
public class WebSecurityConfig {
|
||||
|
||||
|
||||
@Bean
|
||||
public SecurityWebFilterChain securitygWebFilterChain(
|
||||
ServerHttpSecurity http) {
|
||||
return http
|
||||
|
||||
.authorizeExchange()
|
||||
.matchers(EndpointRequest.to(
|
||||
FeaturesEndpoint.class
|
||||
)).permitAll().and().csrf().disable().build();
|
||||
}
|
||||
|
||||
}
|
||||
+1
-9
@@ -4,16 +4,8 @@ import java.util.Collections;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration;
|
||||
|
||||
@SpringBootApplication(exclude = { MongoAutoConfiguration.class,
|
||||
MongoDataAutoConfiguration.class,
|
||||
MongoReactiveDataAutoConfiguration.class,
|
||||
MongoReactiveAutoConfiguration.class }
|
||||
)
|
||||
@SpringBootApplication
|
||||
public class CorsOnAnnotatedElementsApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/web-filter-and-more-on-annotated")
|
||||
//@RestController
|
||||
//@RequestMapping("/web-filter-and-more-on-annotated")
|
||||
public class FurtherCorsConfigsController {
|
||||
|
||||
@DeleteMapping("/further-mixed-config-endpoint")
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/web-filter-on-annotated")
|
||||
//@RestController
|
||||
//@RequestMapping("/web-filter-on-annotated")
|
||||
public class RegularRestController {
|
||||
|
||||
@PutMapping("/regular-put-endpoint")
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.security;
|
||||
package com.baeldung.reactive.security;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.security;
|
||||
package com.baeldung.reactive.security;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Service;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.security;
|
||||
package com.baeldung.reactive.security;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.security.config.annotation.method.configuration.EnableReactiveMethodSecurity;
|
||||
@@ -17,7 +17,7 @@ public class SecurityConfig {
|
||||
public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) {
|
||||
return http.authorizeExchange()
|
||||
.pathMatchers("/admin").hasAuthority("ROLE_ADMIN")
|
||||
.anyExchange().authenticated()
|
||||
.anyExchange().permitAll()
|
||||
.and().formLogin()
|
||||
.and().build();
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.reactive.websocket;
|
||||
package com.baeldung.websocket;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.reactive.websocket;
|
||||
package com.baeldung.websocket;
|
||||
|
||||
import java.net.URI;
|
||||
import java.time.Duration;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.reactive.websocket;
|
||||
package com.baeldung.websocket;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.reactive.websocket;
|
||||
package com.baeldung.websocket;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.baeldung.reactive.websocket;
|
||||
package com.baeldung.websocket;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
+4
-2
@@ -1,6 +1,5 @@
|
||||
package com.baeldung.jupiter;
|
||||
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;
|
||||
@@ -8,6 +7,9 @@ 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;
|
||||
+4
-2
@@ -15,13 +15,15 @@ import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
import com.baeldung.reactive.Spring5ReactiveApplication;
|
||||
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes=Spring5ReactiveApplication.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class EmployeeControllerUnitTest {
|
||||
public class EmployeeControllerIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private WebTestClient testClient;
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.baeldung.security;
|
||||
|
||||
import com.baeldung.SpringSecurity5Application;
|
||||
import com.baeldung.reactive.SpringSecurity5Application;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
+2
-4
@@ -1,11 +1,10 @@
|
||||
package com.baeldung.web.client;
|
||||
|
||||
import com.baeldung.Spring5Application;
|
||||
import com.baeldung.reactive.Spring5ReactiveApplication;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.web.server.LocalServerPort;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
import org.springframework.web.reactive.function.server.RequestPredicates;
|
||||
@@ -16,8 +15,7 @@ import org.springframework.web.server.WebHandler;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Spring5Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@EnableJpaRepositories("com.baeldung.persistence")
|
||||
@SpringBootTest(classes = Spring5ReactiveApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class WebTestClientIntegrationTest {
|
||||
|
||||
@LocalServerPort
|
||||
@@ -6,14 +6,9 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
||||
### Relevant Articles
|
||||
|
||||
- [Concurrent Test Execution in Spring 5](http://www.baeldung.com/spring-5-concurrent-tests)
|
||||
- [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web)
|
||||
- [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching)
|
||||
- [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient)
|
||||
- [Spring 5 Functional Bean Registration](http://www.baeldung.com/spring-5-functional-beans)
|
||||
- [The SpringJUnitConfig and SpringJUnitWebConfig Annotations in Spring 5](http://www.baeldung.com/spring-5-junit-config)
|
||||
- [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive)
|
||||
- [Spring 5 Testing with @EnabledIf Annotation](http://www.baeldung.com/spring-5-enabledIf)
|
||||
- [Introduction to Spring REST Docs](http://www.baeldung.com/spring-rest-docs)
|
||||
- [Spring Security 5 – OAuth2 Login](http://www.baeldung.com/spring-security-5-oauth2-login)
|
||||
- [Spring ResponseStatusException](http://www.baeldung.com/spring-response-status-exception)
|
||||
- [Spring Assert Statements](http://www.baeldung.com/spring-assert)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user