diff --git a/parent-boot-2.0-temp/README.md b/parent-boot-2.0-temp/README.md
new file mode 100644
index 0000000000..8134c8eafe
--- /dev/null
+++ b/parent-boot-2.0-temp/README.md
@@ -0,0 +1,2 @@
+This pom will be ued only temporary until we migrate parent-boot-2 to 2.1.0 for ticket BAEL-10354
+
diff --git a/parent-boot-2.0-temp/pom.xml b/parent-boot-2.0-temp/pom.xml
new file mode 100644
index 0000000000..9284e4af13
--- /dev/null
+++ b/parent-boot-2.0-temp/pom.xml
@@ -0,0 +1,85 @@
+
+ 4.0.0
+ parent-boot-2.0-temp
+ 0.0.1-SNAPSHOT
+ pom
+ Temporary Parent for all Spring Boot 2.0.x modules
+
+
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}
+ pom
+ import
+
+
+
+
+
+ io.rest-assured
+ rest-assured
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ ${spring-boot.version}
+
+ ${start-class}
+
+
+
+
+
+
+
+
+
+ thin-jar
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.springframework.boot.experimental
+ spring-boot-thin-layout
+ ${thin.version}
+
+
+
+
+
+
+
+
+
+ 3.1.0
+
+ 1.0.11.RELEASE
+ 2.0.5.RELEASE
+
+
+
+
diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml
index 89afd79bf4..280d226e95 100644
--- a/parent-boot-2/pom.xml
+++ b/parent-boot-2/pom.xml
@@ -78,7 +78,7 @@
3.1.0
1.0.11.RELEASE
- 2.0.5.RELEASE
+ 2.1.1.RELEASE
diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java
index 16407e510a..2bdd4e5451 100644
--- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java
+++ b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/config/PersistenceConfiguration.java
@@ -1,13 +1,14 @@
package com.baeldung.config;
-import com.baeldung.services.IBarService;
-import com.baeldung.services.impl.BarSpringDataJpaService;
-import com.google.common.base.Preconditions;
-import com.baeldung.dao.repositories.impl.ExtendedRepositoryImpl;
-import com.baeldung.services.IFooService;
-import com.baeldung.services.impl.FooService;
+import java.util.Properties;
+
+import javax.sql.DataSource;
+
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.*;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
@@ -20,13 +21,15 @@ import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
-import javax.sql.DataSource;
-import java.util.Properties;
+import com.baeldung.dao.repositories.impl.ExtendedRepositoryImpl;
+import com.baeldung.services.IBarService;
+import com.baeldung.services.impl.BarSpringDataJpaService;
+import com.google.common.base.Preconditions;
@Configuration
-@ComponentScan({"com.baeldung.dao", "com.baeldung.services"})
+@ComponentScan({ "com.baeldung.dao", "com.baeldung.services" })
@EnableTransactionManagement
-@EnableJpaRepositories(basePackages = {"com.baeldung.dao"}, repositoryBaseClass = ExtendedRepositoryImpl.class)
+@EnableJpaRepositories(basePackages = { "com.baeldung.dao" }, repositoryBaseClass = ExtendedRepositoryImpl.class)
@EnableJpaAuditing
@PropertySource("classpath:persistence.properties")
public class PersistenceConfiguration {
@@ -79,11 +82,6 @@ public class PersistenceConfiguration {
return new BarSpringDataJpaService();
}
- @Bean
- public IFooService fooService() {
- return new FooService();
- }
-
private final Properties hibernateProperties() {
final Properties hibernateProperties = new Properties();
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
@@ -94,7 +92,8 @@ public class PersistenceConfiguration {
// hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
// Envers properties
- hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix"));
+ hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix",
+ env.getProperty("envers.audit_table_suffix"));
return hibernateProperties;
}
diff --git a/persistence-modules/spring-data-jpa/src/main/resources/application.properties b/persistence-modules/spring-data-jpa/src/main/resources/application.properties
index 73d72bc7d6..37fb9ca9c4 100644
--- a/persistence-modules/spring-data-jpa/src/main/resources/application.properties
+++ b/persistence-modules/spring-data-jpa/src/main/resources/application.properties
@@ -12,4 +12,6 @@ hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=true
hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
-spring.datasource.data=import_entities.sql
\ No newline at end of file
+spring.datasource.data=import_entities.sql
+
+spring.main.allow-bean-definition-overriding=true
\ No newline at end of file
diff --git a/persistence-modules/spring-data-jpa/src/test/resources/import_entities.sql b/persistence-modules/spring-data-jpa/src/main/resources/import_entities.sql
similarity index 100%
rename from persistence-modules/spring-data-jpa/src/test/resources/import_entities.sql
rename to persistence-modules/spring-data-jpa/src/main/resources/import_entities.sql
diff --git a/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java
index 0a60412813..7f906bdbcd 100644
--- a/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java
+++ b/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java
@@ -2,17 +2,12 @@ package org.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.Application;
-import com.baeldung.config.PersistenceConfiguration;
-import com.baeldung.config.PersistenceProductConfiguration;
-import com.baeldung.config.PersistenceUserConfiguration;
@RunWith(SpringRunner.class)
-@DataJpaTest(excludeAutoConfiguration = {PersistenceConfiguration.class, PersistenceUserConfiguration.class, PersistenceProductConfiguration.class})
@SpringBootTest(classes = Application.class)
public class SpringContextIntegrationTest {
diff --git a/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringJpaContextIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringJpaContextIntegrationTest.java
new file mode 100644
index 0000000000..66b5b20b97
--- /dev/null
+++ b/persistence-modules/spring-data-jpa/src/test/java/org/baeldung/SpringJpaContextIntegrationTest.java
@@ -0,0 +1,25 @@
+package org.baeldung;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.baeldung.Application;
+import com.baeldung.config.PersistenceConfiguration;
+import com.baeldung.config.PersistenceProductConfiguration;
+import com.baeldung.config.PersistenceUserConfiguration;
+
+@RunWith(SpringRunner.class)
+@DataJpaTest(excludeAutoConfiguration = {
+ PersistenceConfiguration.class,
+ PersistenceUserConfiguration.class,
+ PersistenceProductConfiguration.class })
+@ContextConfiguration(classes = Application.class)
+public class SpringJpaContextIntegrationTest {
+
+ @Test
+ public void whenSpringContextIsBootstrapped_thenNoExceptions() {
+ }
+}
diff --git a/persistence-modules/spring-data-redis/pom.xml b/persistence-modules/spring-data-redis/pom.xml
index 683f874b6c..fb80b0413f 100644
--- a/persistence-modules/spring-data-redis/pom.xml
+++ b/persistence-modules/spring-data-redis/pom.xml
@@ -47,21 +47,9 @@
org.junit.jupiter
junit-jupiter-api
-
- org.junit.jupiter
- junit-jupiter-engine
- test
-
-
- org.junit.platform
- junit-platform-surefire-provider
- ${junit.platform.version}
- test
-
org.junit.platform
junit-platform-runner
- ${junit.platform.version}
test
@@ -97,8 +85,6 @@
0.10.0
2.0.3.RELEASE
0.6
- 1.0.0
- 5.0.2
diff --git a/pom.xml b/pom.xml
index dabb4a9628..4a1db4a937 100644
--- a/pom.xml
+++ b/pom.xml
@@ -324,6 +324,7 @@
parent-boot-1
parent-boot-2
+ parent-boot-2.0-temp
parent-spring-4
parent-spring-5
parent-java
@@ -520,6 +521,7 @@
parent-boot-1
parent-boot-2
+ parent-boot-2.0-temp
parent-spring-4
parent-spring-5
parent-java
@@ -878,6 +880,7 @@
parent-boot-1
parent-boot-2
+ parent-boot-2.0-temp
parent-spring-4
parent-spring-5
parent-java
@@ -1069,6 +1072,7 @@
parent-boot-1
parent-boot-2
+ parent-boot-2.0-temp
parent-spring-4
parent-spring-5
parent-java
@@ -1272,6 +1276,7 @@
parent-boot-1
parent-boot-2
+ parent-boot-2.0-temp
parent-spring-4
parent-spring-5
parent-java
diff --git a/spring-5-data-reactive/src/main/kotlin/com/baeldung/Application.kt b/spring-5-data-reactive/src/main/kotlin/com/baeldung/Application.kt
index af29a429a4..5a59d11de0 100644
--- a/spring-5-data-reactive/src/main/kotlin/com/baeldung/Application.kt
+++ b/spring-5-data-reactive/src/main/kotlin/com/baeldung/Application.kt
@@ -2,8 +2,9 @@ package com.baeldung
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
+import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration
-@SpringBootApplication
+@SpringBootApplication(exclude = arrayOf(MongoReactiveDataAutoConfiguration::class))
class Application
fun main(args: Array) {
diff --git a/spring-5-mvc/src/main/java/com/baeldung/Spring5Application.java b/spring-5-mvc/src/main/java/com/baeldung/Spring5Application.java
index 8251467122..74a348dea6 100644
--- a/spring-5-mvc/src/main/java/com/baeldung/Spring5Application.java
+++ b/spring-5-mvc/src/main/java/com/baeldung/Spring5Application.java
@@ -4,10 +4,11 @@ import javax.servlet.Filter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.web.filter.DelegatingFilterProxy;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
-@SpringBootApplication
+@SpringBootApplication( exclude = SecurityAutoConfiguration.class)
public class Spring5Application {
public static void main(String[] args) {
diff --git a/spring-5-mvc/src/main/kotlin/com/baeldung/springbootkotlin/KotlinDemoApplication.kt b/spring-5-mvc/src/main/kotlin/com/baeldung/springbootkotlin/KotlinDemoApplication.kt
index f95586af80..8904d8d805 100644
--- a/spring-5-mvc/src/main/kotlin/com/baeldung/springbootkotlin/KotlinDemoApplication.kt
+++ b/spring-5-mvc/src/main/kotlin/com/baeldung/springbootkotlin/KotlinDemoApplication.kt
@@ -2,8 +2,9 @@ package com.baeldung.springbootkotlin
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
+import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
-@SpringBootApplication(scanBasePackages = arrayOf("com.baeldung.springbootkotlin"))
+@SpringBootApplication(scanBasePackages = arrayOf("com.baeldung.springbootkotlin"), exclude = arrayOf(SecurityAutoConfiguration::class))
class KotlinDemoApplication
fun main(args: Array) {
diff --git a/spring-5-mvc/src/test/kotlin/com/baeldung/LiveTest.java b/spring-5-mvc/src/test/java/com/baeldung/LiveTest.java
similarity index 100%
rename from spring-5-mvc/src/test/kotlin/com/baeldung/LiveTest.java
rename to spring-5-mvc/src/test/java/com/baeldung/LiveTest.java
diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java
index f07ddfb0f7..03943d436d 100644
--- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java
+++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java
@@ -1,9 +1,7 @@
package com.baeldung.reactive.actuator;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class Spring5ReactiveApplication{
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 f2963c4fa5..325923f577 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,9 @@ 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.ipc.netty.NettyContext;
-import reactor.ipc.netty.http.server.HttpServer;
+
+import reactor.netty.DisposableServer;
+import reactor.netty.http.server.HttpServer;
@ComponentScan(basePackages = {"com.baeldung.reactive.security"})
@EnableWebFlux
@@ -18,17 +19,19 @@ public class SpringSecurity5Application {
public static void main(String[] args) {
try (AnnotationConfigApplicationContext context =
new AnnotationConfigApplicationContext(SpringSecurity5Application.class)) {
- context.getBean(NettyContext.class).onClose().block();
+ context.getBean(DisposableServer.class).onDispose().block();
}
}
@Bean
- public NettyContext nettyContext(ApplicationContext context) {
+ public DisposableServer disposableServer(ApplicationContext context) {
HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context)
.build();
ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
- HttpServer httpServer = HttpServer.create("localhost", 8080);
- return httpServer.newHandler(adapter).block();
+ HttpServer httpServer = HttpServer.create();
+ httpServer.host("localhost");
+ httpServer.port(8080);
+ return httpServer.handle(adapter).bindNow();
}
}
diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml
index e903b57c4e..ab64d1e2fa 100644
--- a/spring-5-reactive/pom.xml
+++ b/spring-5-reactive/pom.xml
@@ -75,6 +75,11 @@
spring-boot-starter-test
test
+
+ org.springframework.security
+ spring-security-test
+ test
+
@@ -116,12 +121,6 @@
${project-reactor-test}
test
-
- org.junit.platform
- junit-platform-runner
- ${junit.platform.version}
- test
-
@@ -145,7 +144,6 @@
1.0
4.1
3.1.6.RELEASE
- 1.2.0
diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/ConsumerSSEApplication.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/ConsumerDebuggingApplication.java
similarity index 80%
rename from spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/ConsumerSSEApplication.java
rename to spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/ConsumerDebuggingApplication.java
index 55db3d7392..486c5e77eb 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/ConsumerSSEApplication.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/consumer/ConsumerDebuggingApplication.java
@@ -14,17 +14,17 @@ import reactor.core.publisher.Hooks;
@SpringBootApplication(exclude = MongoReactiveAutoConfiguration.class)
@EnableScheduling
-public class ConsumerSSEApplication {
+public class ConsumerDebuggingApplication {
public static void main(String[] args) {
Hooks.onOperatorDebug();
- SpringApplication app = new SpringApplication(ConsumerSSEApplication.class);
+ SpringApplication app = new SpringApplication(ConsumerDebuggingApplication.class);
app.setDefaultProperties(Collections.singletonMap("server.port", "8082"));
app.run(args);
}
@Bean
- public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
+ public SecurityWebFilterChain debuggingConsumerSpringSecurityFilterChain(ServerHttpSecurity http) {
http.authorizeExchange()
.anyExchange()
.permitAll();
diff --git a/spring-5-reactive/src/main/java/com/baeldung/debugging/server/ServerSSEApplication.java b/spring-5-reactive/src/main/java/com/baeldung/debugging/server/ServerDebuggingApplication.java
similarity index 77%
rename from spring-5-reactive/src/main/java/com/baeldung/debugging/server/ServerSSEApplication.java
rename to spring-5-reactive/src/main/java/com/baeldung/debugging/server/ServerDebuggingApplication.java
index 6b24ee39f0..4fdc1dd137 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/debugging/server/ServerSSEApplication.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/debugging/server/ServerDebuggingApplication.java
@@ -11,16 +11,16 @@ import org.springframework.web.reactive.config.EnableWebFlux;
@EnableWebFlux
@SpringBootApplication
-public class ServerSSEApplication {
+public class ServerDebuggingApplication {
public static void main(String[] args) {
- SpringApplication app = new SpringApplication(ServerSSEApplication.class);
+ SpringApplication app = new SpringApplication(ServerDebuggingApplication.class);
app.setDefaultProperties(Collections.singletonMap("server.port", "8081"));
app.run(args);
}
@Bean
- public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
+ public SecurityWebFilterChain debuggingServerSpringSecurityFilterChain(ServerHttpSecurity http) {
http.authorizeExchange()
.anyExchange()
.permitAll();
diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java
index a1d5d87d5c..9cbc1b7669 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java
@@ -17,8 +17,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Profile;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.server.reactive.HttpHandler;
import org.springframework.web.reactive.function.server.RouterFunction;
@@ -40,11 +38,14 @@ public class FunctionalSpringBootApplication {
private RouterFunction routingFunction() {
FormHandler formHandler = new FormHandler();
- RouterFunction restfulRouter = route(GET("/"), serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"), serverRequest -> serverRequest.bodyToMono(Actor.class)
- .doOnNext(actors::add)
- .then(ok().build()));
+ RouterFunction restfulRouter = route(GET("/"),
+ serverRequest -> ok().body(Flux.fromIterable(actors), Actor.class)).andRoute(POST("/"),
+ serverRequest -> serverRequest.bodyToMono(Actor.class)
+ .doOnNext(actors::add)
+ .then(ok().build()));
- return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld"))).andRoute(POST("/login"), formHandler::handleLogin)
+ return route(GET("/test"), serverRequest -> ok().body(fromObject("helloworld")))
+ .andRoute(POST("/login"), formHandler::handleLogin)
.andRoute(POST("/upload"), formHandler::handleUpload)
.and(RouterFunctions.resources("/files/**", new ClassPathResource("files/")))
.andNest(path("/actor"), restfulRouter)
@@ -68,5 +69,4 @@ public class FunctionalSpringBootApplication {
public static void main(String[] args) {
SpringApplication.run(FunctionalSpringBootApplication.class, args);
}
-
}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java
index 1656f70221..a8cd18c470 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/Spring5ReactiveApplication.java
@@ -1,9 +1,7 @@
package com.baeldung.reactive;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class Spring5ReactiveApplication{
diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java
index d990928abe..69ae24b849 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java
@@ -4,6 +4,9 @@ import java.util.Collections;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.config.web.server.ServerHttpSecurity;
+import org.springframework.security.web.server.SecurityWebFilterChain;
@SpringBootApplication
public class CorsOnAnnotatedElementsApplication {
@@ -14,4 +17,9 @@ public class CorsOnAnnotatedElementsApplication {
app.run(args);
}
+ @Bean
+ public SecurityWebFilterChain corsAnnotatedSpringSecurityFilterChain(ServerHttpSecurity http) {
+ http.csrf().disable();
+ return http.build();
+ }
}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java
index 8228944569..a70f937980 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java
@@ -8,6 +8,9 @@ import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfigurat
import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.config.web.server.ServerHttpSecurity;
+import org.springframework.security.web.server.SecurityWebFilterChain;
@SpringBootApplication(exclude = { MongoAutoConfiguration.class,
MongoDataAutoConfiguration.class,
@@ -22,4 +25,9 @@ public class CorsGlobalConfigApplication {
app.run(args);
}
+ @Bean
+ public SecurityWebFilterChain corsGlobalSpringSecurityFilterChain(ServerHttpSecurity http) {
+ http.csrf().disable();
+ return http.build();
+ }
}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/FunctionalHandler.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/CorsGlobalFunctionalHandler.java
similarity index 93%
rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/FunctionalHandler.java
rename to spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/CorsGlobalFunctionalHandler.java
index e6e32d7cc8..d2b7af29a6 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/FunctionalHandler.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/CorsGlobalFunctionalHandler.java
@@ -7,7 +7,7 @@ import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;
@Component
-public class FunctionalHandler {
+public class CorsGlobalFunctionalHandler {
public Mono useHandler(final ServerRequest request) {
final String responseMessage = "CORS GLOBAL CONFIG IS NOT EFFECTIVE ON FUNCTIONAL ENDPOINTS!!!";
diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java
index 19621a9e97..0a520828b9 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java
@@ -8,13 +8,13 @@ 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.reactive.cors.global.functional.handlers.FunctionalHandler;
+import com.baeldung.reactive.cors.global.functional.handlers.CorsGlobalFunctionalHandler;
@Configuration
public class CorsRouterFunctions {
@Bean
- public RouterFunction responseHeaderRoute(@Autowired FunctionalHandler handler) {
+ public RouterFunction corsGlobalRouter(@Autowired CorsGlobalFunctionalHandler handler) {
return RouterFunctions.route(RequestPredicates.PUT("/global-config-on-functional/cors-disabled-functional-endpoint"), handler::useHandler);
}
}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java
index 38140c0d71..7792975768 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java
@@ -8,6 +8,9 @@ import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfigurat
import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.config.web.server.ServerHttpSecurity;
+import org.springframework.security.web.server.SecurityWebFilterChain;
@SpringBootApplication(exclude = { MongoAutoConfiguration.class,
MongoDataAutoConfiguration.class,
@@ -21,5 +24,11 @@ public class CorsWebFilterApplication {
app.setDefaultProperties(Collections.singletonMap("server.port", "8083"));
app.run(args);
}
+
+ @Bean
+ public SecurityWebFilterChain corsWebfilterSpringSecurityFilterChain(ServerHttpSecurity http) {
+ http.csrf().disable();
+ return http.build();
+ }
}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java
index a3905bb79f..6056b9bf5a 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java
@@ -14,7 +14,7 @@ import com.baeldung.reactive.cors.webfilter.functional.handlers.CorsWithWebFilte
public class CorsWithWebFilterRouterFunctions {
@Bean
- public RouterFunction responseHeaderRoute(@Autowired CorsWithWebFilterHandler handler) {
+ public RouterFunction corsWebfilterRouter(@Autowired CorsWithWebFilterHandler handler) {
return RouterFunctions.route(RequestPredicates.PUT("/web-filter-on-functional/functional-endpoint"), handler::useHandler);
}
}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java
index 3997607ef0..d8edaf7fd5 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java
@@ -4,9 +4,13 @@ import java.util.Collections;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration;
+import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.security.config.web.server.ServerHttpSecurity;
+import org.springframework.security.web.server.SecurityWebFilterChain;
-@SpringBootApplication
+@SpringBootApplication(exclude = { RedisReactiveAutoConfiguration.class })
@EnableAsync
public class ConsumerSSEApplication {
@@ -15,5 +19,13 @@ public class ConsumerSSEApplication {
app.setDefaultProperties(Collections.singletonMap("server.port", "8082"));
app.run(args);
}
+
+ @Bean
+ public SecurityWebFilterChain sseConsumerSpringSecurityFilterChain(ServerHttpSecurity http) {
+ http.authorizeExchange()
+ .anyExchange()
+ .permitAll();
+ return http.build();
+ }
}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java
index 2750e6616d..c040b83da0 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java
@@ -4,14 +4,26 @@ import java.util.Collections;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.data.redis.RedisReactiveAutoConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.config.web.server.ServerHttpSecurity;
+import org.springframework.security.web.server.SecurityWebFilterChain;
-@SpringBootApplication
+@SpringBootApplication(exclude = { RedisReactiveAutoConfiguration.class })
public class ServerSSEApplication {
-
+
public static void main(String[] args) {
SpringApplication app = new SpringApplication(ServerSSEApplication.class);
app.setDefaultProperties(Collections.singletonMap("server.port", "8081"));
app.run(args);
}
+ @Bean
+ public SecurityWebFilterChain sseServerSpringSecurityFilterChain(ServerHttpSecurity http) {
+ http.authorizeExchange()
+ .anyExchange()
+ .permitAll();
+ return http.build();
+ }
+
}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/FunctionalValidationsApplication.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/FunctionalValidationsApplication.java
index e548e33c85..4cbb65dc60 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/FunctionalValidationsApplication.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/FunctionalValidationsApplication.java
@@ -2,6 +2,9 @@ package com.baeldung.validations.functional;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.config.web.server.ServerHttpSecurity;
+import org.springframework.security.web.server.SecurityWebFilterChain;
@SpringBootApplication
public class FunctionalValidationsApplication {
@@ -9,4 +12,13 @@ public class FunctionalValidationsApplication {
public static void main(String[] args) {
SpringApplication.run(FunctionalValidationsApplication.class, args);
}
+
+ @Bean
+ public SecurityWebFilterChain functionalValidationsSpringSecurityFilterChain(ServerHttpSecurity http) {
+ http.authorizeExchange()
+ .anyExchange()
+ .permitAll();
+ http.csrf().disable();
+ return http.build();
+ }
}
diff --git a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/routers/ValidationsRouters.java b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/routers/ValidationsRouters.java
index efbdbe3f99..29582a0b0f 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/validations/functional/routers/ValidationsRouters.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/validations/functional/routers/ValidationsRouters.java
@@ -17,7 +17,7 @@ import com.baeldung.validations.functional.handlers.impl.OtherEntityValidationHa
public class ValidationsRouters {
@Bean
- public RouterFunction responseHeaderRoute(@Autowired CustomRequestEntityValidationHandler dryHandler,
+ public RouterFunction validationsRouter(@Autowired CustomRequestEntityValidationHandler dryHandler,
@Autowired FunctionalHandler complexHandler,
@Autowired OtherEntityValidationHandler otherHandler,
@Autowired AnnotatedRequestEntityValidationHandler annotatedEntityHandler) {
diff --git a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java
index 452bcac8ab..61927e47ab 100644
--- a/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java
+++ b/spring-5-reactive/src/main/java/com/baeldung/websession/configuration/WebFluxSecurityConfig.java
@@ -34,9 +34,8 @@ public class WebFluxSecurityConfig {
}
@Bean
- public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
- http
- .authorizeExchange()
+ public SecurityWebFilterChain webSessionSpringSecurityFilterChain(ServerHttpSecurity http) {
+ http.authorizeExchange()
.anyExchange().authenticated()
.and()
.httpBasic()
@@ -44,8 +43,7 @@ public class WebFluxSecurityConfig {
.and()
.formLogin();
- http
- .csrf().disable();
+ http.csrf().disable();
return http.build();
diff --git a/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java
index 4dea2a05cf..1256d5f129 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java
@@ -10,6 +10,7 @@ import org.springframework.boot.web.server.WebServer;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
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 5ebfa39358..b8dd9c9509 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
@@ -1,6 +1,10 @@
package com.baeldung.reactive;
-import com.baeldung.web.reactive.Task;
+import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
+import static org.springframework.web.reactive.function.server.RequestPredicates.POST;
+
+import java.time.Duration;
+
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.springframework.http.server.reactive.HttpHandler;
@@ -8,22 +12,22 @@ 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 java.time.Duration;
-
-import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
-import static org.springframework.web.reactive.function.server.RequestPredicates.POST;
+import reactor.netty.DisposableServer;
+import reactor.netty.http.server.HttpServer;
public class Spring5ReactiveServerClientIntegrationTest {
- private static NettyContext nettyContext;
+ private static DisposableServer disposableServer;
@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))
@@ -31,13 +35,13 @@ 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();
+ disposableServer = server.handle(adapter)
+ .bindNow();
}
@AfterAll
public static void shutDown() {
- nettyContext.dispose();
+ disposableServer.disposeNow();
}
// @Test
diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java
index 0043d62e5a..e6847e63da 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java
@@ -2,13 +2,10 @@ package com.baeldung.reactive.cors;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec;
-@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class CorsOnAnnotatedElementsLiveTest {
diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java
index 39927af4c3..008f1a16f2 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java
@@ -2,13 +2,10 @@ package com.baeldung.reactive.cors;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec;
-@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class CorsOnGlobalConfigLiveTest {
diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java
index e5a3c8a99a..f8a4f34e29 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java
@@ -2,13 +2,10 @@ package com.baeldung.reactive.cors;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec;
-@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class CorsOnWebFilterLiveTest {
diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java
index bea2eaa75f..10cfaffce4 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/errorhandling/ErrorHandlingIntegrationTest.java
@@ -8,11 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT)
+@WithMockUser
public class ErrorHandlingIntegrationTest {
@Autowired
diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java
index bb2408ea79..fbf46a93cc 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/PlayerHandlerIntegrationTest.java
@@ -4,6 +4,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.EntityExchangeResult;
import org.springframework.test.web.reactive.server.WebTestClient;
@@ -12,6 +13,7 @@ import static org.junit.Assert.assertEquals;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@WithMockUser
public class PlayerHandlerIntegrationTest {
@Autowired
diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/UserControllerIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/UserControllerIntegrationTest.java
index e7d289e5c4..22991b298f 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/UserControllerIntegrationTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/filters/UserControllerIntegrationTest.java
@@ -4,6 +4,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.EntityExchangeResult;
import org.springframework.test.web.reactive.server.WebTestClient;
@@ -12,6 +13,7 @@ import static org.junit.Assert.assertEquals;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@WithMockUser
public class UserControllerIntegrationTest {
@Autowired
diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/responseheaders/ResponseHeaderLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/responseheaders/ResponseHeaderLiveTest.java
index db563e27d1..927c52e7e6 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/reactive/responseheaders/ResponseHeaderLiveTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/responseheaders/ResponseHeaderLiveTest.java
@@ -2,13 +2,10 @@ package com.baeldung.reactive.responseheaders;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec;
-@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ResponseHeaderLiveTest {
diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java
index 53f4a3b1bb..547cd99034 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java
@@ -3,14 +3,13 @@ package com.baeldung.reactive.serversentsevents;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
-import org.junit.platform.runner.JUnitPlatform;
-import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
+import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.reactive.server.WebTestClient;
-@RunWith(JUnitPlatform.class)
@SpringBootTest
+@WithMockUser
public class ServiceSentEventLiveTest {
private WebTestClient client = WebTestClient.bindToServer()
diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/PathPatternsUsingHandlerMethodIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/PathPatternsUsingHandlerMethodIntegrationTest.java
index 9f31608ff7..d4c1cfe4c8 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/PathPatternsUsingHandlerMethodIntegrationTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/PathPatternsUsingHandlerMethodIntegrationTest.java
@@ -4,6 +4,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
@@ -12,6 +13,7 @@ import com.baeldung.reactive.controller.PathPatternController;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Spring5ReactiveApplication.class)
+@WithMockUser
public class PathPatternsUsingHandlerMethodIntegrationTest {
private static WebTestClient client;
diff --git a/spring-5-reactive/src/test/java/com/baeldung/validations/functional/FunctionalEndpointValidationsLiveTest.java b/spring-5-reactive/src/test/java/com/baeldung/validations/functional/FunctionalEndpointValidationsLiveTest.java
index 5fe764bf8f..73968cdf05 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/validations/functional/FunctionalEndpointValidationsLiveTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/validations/functional/FunctionalEndpointValidationsLiveTest.java
@@ -2,9 +2,7 @@ package com.baeldung.validations.functional;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec;
@@ -13,7 +11,6 @@ import com.baeldung.validations.functional.model.CustomRequestEntity;
import reactor.core.publisher.Mono;
-@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class FunctionalEndpointValidationsLiveTest {
diff --git a/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java
index 08bd883b0b..2e37f2ffbd 100644
--- a/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java
+++ b/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java
@@ -1,10 +1,10 @@
package com.baeldung.web.client;
-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.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.web.reactive.function.server.RequestPredicates;
@@ -12,10 +12,14 @@ 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 org.springframework.web.server.WebHandler;
+
+import com.baeldung.reactive.Spring5ReactiveApplication;
+
import reactor.core.publisher.Mono;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Spring5ReactiveApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@WithMockUser
public class WebTestClientIntegrationTest {
@LocalServerPort
diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml
index 763e505e51..c26e370381 100644
--- a/spring-5-security/pom.xml
+++ b/spring-5-security/pom.xml
@@ -31,7 +31,7 @@
org.thymeleaf.extras
- thymeleaf-extras-springsecurity4
+ thymeleaf-extras-springsecurity5
org.springframework
diff --git a/spring-5-security/src/main/resources/templatesextrafields/index.html b/spring-5-security/src/main/resources/templatesextrafields/index.html
index 37833ff0d2..1dd9c12d42 100644
--- a/spring-5-security/src/main/resources/templatesextrafields/index.html
+++ b/spring-5-security/src/main/resources/templatesextrafields/index.html
@@ -1,5 +1,5 @@
-
+
Spring Security with Extra Fields
diff --git a/spring-5/pom.xml b/spring-5/pom.xml
index 293edb5bda..58c14475e0 100644
--- a/spring-5/pom.xml
+++ b/spring-5/pom.xml
@@ -135,7 +135,8 @@
-
+
org.apache.maven.plugins
maven-surefire-plugin
@@ -143,14 +144,6 @@
methods
true
-
- **/*IntegrationTest.java
- **/*IntTest.java
- **/*LongRunningUnitTest.java
- **/*ManualTest.java
- **/JdbcTest.java
- **/*LiveTest.java
-
diff --git a/spring-5/src/main/java/com/baeldung/exception/SpringExceptionApplication.java b/spring-5/src/main/java/com/baeldung/exception/SpringExceptionApplication.java
index ed163f7fa7..82a5fe083b 100644
--- a/spring-5/src/main/java/com/baeldung/exception/SpringExceptionApplication.java
+++ b/spring-5/src/main/java/com/baeldung/exception/SpringExceptionApplication.java
@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfi
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
-@ComponentScan(basePackages = { "com.baeldung.execption" })
+@ComponentScan(basePackages = { "com.baeldung.exception" })
public class SpringExceptionApplication {
public static void main(String[] args) {
SpringApplication.run(SpringExceptionApplication.class, args);
diff --git a/spring-5/src/main/java/com/baeldung/jsonb/Spring5Application.java b/spring-5/src/main/java/com/baeldung/jsonb/Spring5Application.java
index 00fce06834..540992b4bc 100644
--- a/spring-5/src/main/java/com/baeldung/jsonb/Spring5Application.java
+++ b/spring-5/src/main/java/com/baeldung/jsonb/Spring5Application.java
@@ -6,12 +6,13 @@ import java.util.Collection;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.JsonbHttpMessageConverter;
-@SpringBootApplication
+@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
@ComponentScan(basePackages = { "com.baeldung.jsonb" })
public class Spring5Application {
diff --git a/spring-5/src/main/java/com/baeldung/restdocs/SpringRestDocsApplication.java b/spring-5/src/main/java/com/baeldung/restdocs/SpringRestDocsApplication.java
index 02332ee7b6..f512b52af4 100644
--- a/spring-5/src/main/java/com/baeldung/restdocs/SpringRestDocsApplication.java
+++ b/spring-5/src/main/java/com/baeldung/restdocs/SpringRestDocsApplication.java
@@ -2,8 +2,9 @@ package com.baeldung.restdocs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
-@SpringBootApplication
+@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
public class SpringRestDocsApplication {
public static void main(String[] args) {
diff --git a/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java b/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java
index ecc677465e..8b9e66213f 100644
--- a/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java
+++ b/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java
@@ -3,12 +3,10 @@ package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
-@EnableJpaRepositories("com.baeldung.persistence")
public class Example1IntegrationTest {
@Test
diff --git a/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java b/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java
index e1d56c2fc3..6ed53ca4e9 100644
--- a/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java
+++ b/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java
@@ -3,12 +3,10 @@ package com.baeldung;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
-@EnableJpaRepositories("com.baeldung.persistence")
public class Example2IntegrationTest {
@Test
diff --git a/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java b/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java
index fba01726f4..9c462e0412 100644
--- a/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java
+++ b/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java
@@ -1,12 +1,11 @@
package com.baeldung.functional;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.context.support.GenericWebApplicationContext;
@@ -14,7 +13,6 @@ import com.baeldung.Spring5Application;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Spring5Application.class)
-@EnableJpaRepositories("com.baeldung.persistence")
public class BeanRegistrationIntegrationTest {
@Autowired
diff --git a/spring-boot-autoconfiguration/pom.xml b/spring-boot-autoconfiguration/pom.xml
index 1c3d8796ed..87418bd2c7 100644
--- a/spring-boot-autoconfiguration/pom.xml
+++ b/spring-boot-autoconfiguration/pom.xml
@@ -9,10 +9,10 @@
This is simple boot application demonstrating a custom auto-configuration
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../parent-boot-2.0-temp
diff --git a/spring-boot-bootstrap/pom.xml b/spring-boot-bootstrap/pom.xml
index b5bf4bc7b6..4b0abd5f2e 100644
--- a/spring-boot-bootstrap/pom.xml
+++ b/spring-boot-bootstrap/pom.xml
@@ -8,10 +8,10 @@
spring-boot-bootstrap
Demo project for Spring Boot
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../parent-boot-2.0-temp
diff --git a/spring-boot-client/pom.xml b/spring-boot-client/pom.xml
index fc89931f79..282488c4b1 100644
--- a/spring-boot-client/pom.xml
+++ b/spring-boot-client/pom.xml
@@ -9,10 +9,10 @@
This is simple boot client application for Spring boot actuator test
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../parent-boot-2.0-temp
diff --git a/spring-boot-ctx-fluent/pom.xml b/spring-boot-ctx-fluent/pom.xml
index b238374612..52139fec3c 100644
--- a/spring-boot-ctx-fluent/pom.xml
+++ b/spring-boot-ctx-fluent/pom.xml
@@ -8,10 +8,10 @@
jar
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../parent-boot-2.0-temp
diff --git a/spring-boot-disable-console-logging/pom.xml b/spring-boot-disable-console-logging/pom.xml
index 63ed129347..c8c43ada7a 100644
--- a/spring-boot-disable-console-logging/pom.xml
+++ b/spring-boot-disable-console-logging/pom.xml
@@ -7,10 +7,10 @@
Projects for Disabling Spring Boot Console Logging tutorials
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../parent-boot-2.0-temp
diff --git a/spring-boot-jasypt/pom.xml b/spring-boot-jasypt/pom.xml
index de0df92678..a1707b45b0 100644
--- a/spring-boot-jasypt/pom.xml
+++ b/spring-boot-jasypt/pom.xml
@@ -10,10 +10,10 @@
Demo project for Spring Boot
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../parent-boot-2.0-temp
diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml
index b219e53431..8191645d76 100644
--- a/spring-boot-mvc/pom.xml
+++ b/spring-boot-mvc/pom.xml
@@ -8,10 +8,10 @@
Module For Spring Boot MVC
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../parent-boot-2.0-temp
diff --git a/spring-boot-ops/pom.xml b/spring-boot-ops/pom.xml
index 57779c3f8e..760fc69462 100644
--- a/spring-boot-ops/pom.xml
+++ b/spring-boot-ops/pom.xml
@@ -9,10 +9,10 @@
Demo project for Spring Boot
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../parent-boot-2.0-temp
diff --git a/spring-boot-vue/pom.xml b/spring-boot-vue/pom.xml
index d581b11d68..919f3e0ff9 100644
--- a/spring-boot-vue/pom.xml
+++ b/spring-boot-vue/pom.xml
@@ -12,10 +12,10 @@
Demo project for Spring Boot Vue project
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../parent-boot-2.0-temp
diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml
index 87c782b044..40caf4fb97 100644
--- a/spring-boot/pom.xml
+++ b/spring-boot/pom.xml
@@ -8,10 +8,10 @@
This is simple boot application for Spring boot actuator test
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../parent-boot-2
+ ../parent-boot-2.0-temp
diff --git a/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml b/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml
index 779a4a803a..10071727f7 100644
--- a/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml
+++ b/spring-cloud-data-flow/etl/customer-mongodb-sink/pom.xml
@@ -11,10 +11,10 @@
Example ETL Load Project
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../../../parent-boot-2
+ ../../../parent-boot-2.0-temp
diff --git a/spring-cloud-data-flow/etl/customer-transform/pom.xml b/spring-cloud-data-flow/etl/customer-transform/pom.xml
index c344b0fc57..a181020e77 100644
--- a/spring-cloud-data-flow/etl/customer-transform/pom.xml
+++ b/spring-cloud-data-flow/etl/customer-transform/pom.xml
@@ -12,10 +12,10 @@
Example transform ETL step
- parent-boot-2
+ parent-boot-2.0-temp
com.baeldung
0.0.1-SNAPSHOT
- ../../../parent-boot-2
+ ../../../parent-boot-2.0-temp
diff --git a/spring-cloud/spring-cloud-vault/pom.xml b/spring-cloud/spring-cloud-vault/pom.xml
index 68b8e44875..a19d7f3459 100644
--- a/spring-cloud/spring-cloud-vault/pom.xml
+++ b/spring-cloud/spring-cloud-vault/pom.xml
@@ -12,9 +12,9 @@
com.baeldung
- parent-boot-2
+ parent-boot-2.0-temp
0.0.1-SNAPSHOT
- ../../parent-boot-2
+ ../../parent-boot-2.0-temp