diff --git a/actuator/pom.xml b/actuator/pom.xml
index 7aa15262..bcde71c2 100644
--- a/actuator/pom.xml
+++ b/actuator/pom.xml
@@ -1,30 +1,34 @@
-
-
- 4.0.0
-
- com.metaxiii.fr
- parent
- 1.0-SNAPSHOT
-
- actuator
- 0.0.1-SNAPSHOT
- actuator
- actuator
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
+
+
+ 4.0.0
+
+ com.metaxiii.fr
+ parent
+ 1.0-SNAPSHOT
+
+ actuator
+ 0.0.1-SNAPSHOT
+ actuator
+ actuator
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-webmvc-test
+
+
+
diff --git a/actuator/src/test/java/com/metaxiii/fr/actuator/ActuatorApplicationTests.java b/actuator/src/test/java/com/metaxiii/fr/actuator/ActuatorApplicationTests.java
index a2878bf8..3a019e16 100644
--- a/actuator/src/test/java/com/metaxiii/fr/actuator/ActuatorApplicationTests.java
+++ b/actuator/src/test/java/com/metaxiii/fr/actuator/ActuatorApplicationTests.java
@@ -6,8 +6,8 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
diff --git a/avoid-no-multipart-boundary-was-found/pom.xml b/avoid-no-multipart-boundary-was-found/pom.xml
index 9661f805..0390f86d 100644
--- a/avoid-no-multipart-boundary-was-found/pom.xml
+++ b/avoid-no-multipart-boundary-was-found/pom.xml
@@ -12,7 +12,7 @@
avoid-no-multipart-boundary-was-found
avoid-no-multipart-boundary-was-found
- 17
+ 21
5.3.2
diff --git a/entity-dto-conversion-rest-api/pom.xml b/entity-dto-conversion-rest-api/pom.xml
index 1e31d6fc..6c13253f 100644
--- a/entity-dto-conversion-rest-api/pom.xml
+++ b/entity-dto-conversion-rest-api/pom.xml
@@ -40,5 +40,13 @@
h2
runtime
+
+ org.springframework.boot
+ spring-boot-data-jpa-test
+
+
+ org.springframework.boot
+ spring-boot-webmvc-test
+
diff --git a/entity-dto-conversion-rest-api/src/test/java/com/metaxiii/fr/entitydtoconversionrestapi/controller/PostControllerTest.java b/entity-dto-conversion-rest-api/src/test/java/com/metaxiii/fr/entitydtoconversionrestapi/controller/PostControllerTest.java
index 2ee5150b..86189be4 100644
--- a/entity-dto-conversion-rest-api/src/test/java/com/metaxiii/fr/entitydtoconversionrestapi/controller/PostControllerTest.java
+++ b/entity-dto-conversion-rest-api/src/test/java/com/metaxiii/fr/entitydtoconversionrestapi/controller/PostControllerTest.java
@@ -5,24 +5,24 @@
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.metaxiii.fr.entitydtoconversionrestapi.config.Config;
import com.metaxiii.fr.entitydtoconversionrestapi.dto.PostDto;
import java.util.List;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.web.servlet.MockMvc;
+import tools.jackson.core.type.TypeReference;
+import tools.jackson.databind.json.JsonMapper;
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@Import(Config.class)
-@Sql(scripts = "classpath:/init-db/post.sql")
@AutoConfigureMockMvc
+@Sql(scripts = "classpath:/init-db/post.sql")
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class PostControllerTest {
@Autowired
@@ -32,7 +32,7 @@ class PostControllerTest {
void getPosts() throws Exception {
final var url = "/0/1/asc/userName";
final var mvcResult = mockMvc.perform(get(url)).andDo(print()).andExpect(status().isOk()).andReturn();
- ObjectMapper objectMapper = new ObjectMapper();
+ final var objectMapper = new JsonMapper();
Assertions.assertDoesNotThrow(() -> {
final List result = objectMapper.readValue(
mvcResult.getResponse().getContentAsString(),
diff --git a/entity-dto-conversion-rest-api/src/test/java/com/metaxiii/fr/entitydtoconversionrestapi/service/impl/PostServiceImplTest.java b/entity-dto-conversion-rest-api/src/test/java/com/metaxiii/fr/entitydtoconversionrestapi/service/impl/PostServiceImplTest.java
index 90bfe4fb..c6bc8f12 100644
--- a/entity-dto-conversion-rest-api/src/test/java/com/metaxiii/fr/entitydtoconversionrestapi/service/impl/PostServiceImplTest.java
+++ b/entity-dto-conversion-rest-api/src/test/java/com/metaxiii/fr/entitydtoconversionrestapi/service/impl/PostServiceImplTest.java
@@ -7,7 +7,7 @@
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
+import org.springframework.boot.data.jpa.test.autoconfigure.DataJpaTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.test.context.jdbc.Sql;
diff --git a/error-handling-for-rest-with-spring/pom.xml b/error-handling-for-rest-with-spring/pom.xml
index f9c674dd..b5020ee7 100644
--- a/error-handling-for-rest-with-spring/pom.xml
+++ b/error-handling-for-rest-with-spring/pom.xml
@@ -1,42 +1,46 @@
-
-
- 4.0.0
-
- com.metaxiii.fr
- parent
- 1.0-SNAPSHOT
- ../pom.xml
-
- com.metaxiii.fr
- error-handling-for-rest-with-spring
- 0.0.1-SNAPSHOT
- error-handling-for-rest-with-spring
- error-handling-for-rest-with-spring
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- com.h2database
- h2
- runtime
-
-
- org.projectlombok
- lombok
- true
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
+
+
+ 4.0.0
+
+ com.metaxiii.fr
+ parent
+ 1.0-SNAPSHOT
+ ../pom.xml
+
+ com.metaxiii.fr
+ error-handling-for-rest-with-spring
+ 0.0.1-SNAPSHOT
+ error-handling-for-rest-with-spring
+ error-handling-for-rest-with-spring
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ com.h2database
+ h2
+ runtime
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-webmvc-test
+
+
+
diff --git a/error-handling-for-rest-with-spring/src/test/java/com/metaxiii/fr/errorhandlingforrestwithspring/controller/ApiExceptionHandlerTest.java b/error-handling-for-rest-with-spring/src/test/java/com/metaxiii/fr/errorhandlingforrestwithspring/controller/ApiExceptionHandlerTest.java
index cc29b768..73f32edb 100644
--- a/error-handling-for-rest-with-spring/src/test/java/com/metaxiii/fr/errorhandlingforrestwithspring/controller/ApiExceptionHandlerTest.java
+++ b/error-handling-for-rest-with-spring/src/test/java/com/metaxiii/fr/errorhandlingforrestwithspring/controller/ApiExceptionHandlerTest.java
@@ -16,11 +16,6 @@ class ApiExceptionHandlerTest {
private ApiExceptionHandler apiExceptionHandler;
- @BeforeEach
- public void init() {
- this.apiExceptionHandler = new ApiExceptionHandler();
- }
-
@AfterEach
public void endEach() {
this.apiExceptionHandler = null;
@@ -40,8 +35,12 @@ void handleAccessDeniedException() {
private WebRequest getWebRequest() {
final Connector connector = new Connector();
- final Request request = new Request(connector);
- request.setCoyoteRequest(new org.apache.coyote.Request());
+ final Request request = new Request(connector, new org.apache.coyote.Request());
return new ServletWebRequest(request);
}
+
+ @BeforeEach
+ void init() {
+ this.apiExceptionHandler = new ApiExceptionHandler();
+ }
}
diff --git a/error-handling-for-rest-with-spring/src/test/java/com/metaxiii/fr/errorhandlingforrestwithspring/controller/FooControllerTest.java b/error-handling-for-rest-with-spring/src/test/java/com/metaxiii/fr/errorhandlingforrestwithspring/controller/FooControllerTest.java
index 187566a2..d66529a9 100644
--- a/error-handling-for-rest-with-spring/src/test/java/com/metaxiii/fr/errorhandlingforrestwithspring/controller/FooControllerTest.java
+++ b/error-handling-for-rest-with-spring/src/test/java/com/metaxiii/fr/errorhandlingforrestwithspring/controller/FooControllerTest.java
@@ -6,8 +6,8 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
import org.springframework.test.web.servlet.MockMvc;
@SpringBootTest
diff --git a/hibernate-reactive/pom.xml b/hibernate-reactive/pom.xml
index 3b4f4ad5..753d0e48 100644
--- a/hibernate-reactive/pom.xml
+++ b/hibernate-reactive/pom.xml
@@ -1,57 +1,54 @@
-
-
- 4.0.0
-
- com.metaxiii.fr
- parent
- 1.0-SNAPSHOT
-
- hibernate-reactive
- 0.0.1-SNAPSHOT
- hibernate-reactive
- hibernate-reactive
-
- 17
-
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
-
- com.h2database
- h2
- runtime
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.springframework.boot
- spring-boot-starter-data-r2dbc
-
-
- io.r2dbc
- r2dbc-h2
-
-
- io.projectreactor
- reactor-test
- test
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
+
+
+ 4.0.0
+
+ com.metaxiii.fr
+ parent
+ 1.0-SNAPSHOT
+
+ hibernate-reactive
+ 0.0.1-SNAPSHOT
+ hibernate-reactive
+ hibernate-reactive
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+
+ com.h2database
+ h2
+ runtime
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-data-r2dbc
+
+
+ io.r2dbc
+ r2dbc-h2
+
+
+ io.projectreactor
+ reactor-test
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/jackson-json-view/pom.xml b/jackson-json-view/pom.xml
index cea7c606..9905efdb 100644
--- a/jackson-json-view/pom.xml
+++ b/jackson-json-view/pom.xml
@@ -1,50 +1,54 @@
-
-
- parent
- com.metaxiii.fr
- 1.0-SNAPSHOT
-
- 4.0.0
-
- jackson-json-view
- jar
-
- jackson-json-view
-
-
- UTF-8
-
-
-
-
- org.projectlombok
- lombok
-
-
- com.fasterxml.jackson.core
- jackson-annotations
-
-
- com.fasterxml.jackson.core
- jackson-core
-
-
- org.springframework
- spring-web
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
+
+
+ parent
+ com.metaxiii.fr
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ jackson-json-view
+ jar
+
+ jackson-json-view
+
+
+ UTF-8
+
+
+
+
+ org.projectlombok
+ lombok
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+
+
+ org.springframework
+ spring-web
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-webmvc-test
+
+
+
diff --git a/jackson-json-view/src/test/java/com/metaxiii/fr/controller/ItemControllerTest.java b/jackson-json-view/src/test/java/com/metaxiii/fr/controller/ItemControllerTest.java
index 2f966df4..4ab065af 100644
--- a/jackson-json-view/src/test/java/com/metaxiii/fr/controller/ItemControllerTest.java
+++ b/jackson-json-view/src/test/java/com/metaxiii/fr/controller/ItemControllerTest.java
@@ -10,10 +10,9 @@
import com.metaxiii.fr.model.Item;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
import org.springframework.http.MediaType;
-import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
@@ -49,8 +48,8 @@ void getItemPublic() throws Exception {
final Item item = new ObjectMapper().readValue(mvcResult.getResponse().getContentAsString(), Item.class);
assertEquals(1, item.getId());
assertEquals("item name", item.getItemName());
- Jackson2ObjectMapperBuilder mapperBuilder = new Jackson2ObjectMapperBuilder();
- final ObjectMapper mapper = mapperBuilder.build().setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ final var mapper = new ObjectMapper();
+ mapper.setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL);
final String string = mapper.writeValueAsString(item);
assertEquals("{\"id\":1,\"itemName\":\"item name\"}", string);
}
diff --git a/mapstruct-lombok/pom.xml b/mapstruct-lombok/pom.xml
index 893ae00d..4e7191a8 100644
--- a/mapstruct-lombok/pom.xml
+++ b/mapstruct-lombok/pom.xml
@@ -14,7 +14,6 @@
UTF-8
- 17
1.18.42
1.6.3
0.2.0
diff --git a/pom.xml b/pom.xml
index 7d7f95b5..a8bfba76 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.5.8
+ 4.0.0
diff --git a/spring security integration test/pom.xml b/spring security integration test/pom.xml
index 9fc2e670..79176eed 100644
--- a/spring security integration test/pom.xml
+++ b/spring security integration test/pom.xml
@@ -31,5 +31,13 @@
spring-security-test
test
+
+ org.springframework.boot
+ spring-boot-resttestclient
+
+
+ org.springframework.boot
+ spring-boot-starter-webmvc-test
+
diff --git a/spring security integration test/src/main/java/com/metaxiii/fr/configuration/WebSecurityConfigurer.java b/spring security integration test/src/main/java/com/metaxiii/fr/configuration/WebSecurityConfigurer.java
index 3a0a8651..77276cb1 100644
--- a/spring security integration test/src/main/java/com/metaxiii/fr/configuration/WebSecurityConfigurer.java
+++ b/spring security integration test/src/main/java/com/metaxiii/fr/configuration/WebSecurityConfigurer.java
@@ -15,12 +15,13 @@
public class WebSecurityConfigurer {
@Bean
- public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
- http
+ public SecurityFilterChain filterChain(final HttpSecurity http) {
+ return http
.authorizeHttpRequests(cust -> cust.requestMatchers("/private/**").hasRole("USER"))
.authorizeHttpRequests(cust -> cust.requestMatchers("/public/**").permitAll())
- .httpBasic(Customizer.withDefaults());
- return http.build();
+ .authorizeHttpRequests(cust -> cust.anyRequest().authenticated())
+ .httpBasic(Customizer.withDefaults())
+ .build();
}
@Bean
diff --git a/spring security integration test/src/test/java/com/metaxiii/fr/controller/SecuredControllerRestTemplateIntegrationTest.java b/spring security integration test/src/test/java/com/metaxiii/fr/controller/SecuredControllerRestTemplateIntegrationTest.java
index 2e2b5e7f..0171838e 100644
--- a/spring security integration test/src/test/java/com/metaxiii/fr/controller/SecuredControllerRestTemplateIntegrationTest.java
+++ b/spring security integration test/src/test/java/com/metaxiii/fr/controller/SecuredControllerRestTemplateIntegrationTest.java
@@ -4,20 +4,22 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.resttestclient.TestRestTemplate;
+import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+@AutoConfigureTestRestTemplate
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class SecuredControllerRestTemplateIntegrationTest {
@Autowired
- private TestRestTemplate template;
+ private TestRestTemplate testRestTemplate;
@Test
void givenAuthRequestOnPrivateService_shouldSucceedWith200() {
- ResponseEntity result = template
+ final ResponseEntity result = testRestTemplate
.withBasicAuth("spring", "secret")
.getForEntity("/private/hello", String.class);
assertEquals(HttpStatus.OK, result.getStatusCode());
@@ -25,7 +27,7 @@ void givenAuthRequestOnPrivateService_shouldSucceedWith200() {
@Test
void givenRequestOnPrivateService_shouldFailWith401() {
- ResponseEntity result = template.getForEntity("/private/hello", String.class);
+ final ResponseEntity result = testRestTemplate.getForEntity("/private/hello", String.class);
assertEquals(HttpStatus.UNAUTHORIZED, result.getStatusCode());
}
}
diff --git a/spring security integration test/src/test/java/com/metaxiii/fr/controller/SecuredControllerSpringBootIntegrationTest.java b/spring security integration test/src/test/java/com/metaxiii/fr/controller/SecuredControllerSpringBootIntegrationTest.java
index 27f2201c..a38e9467 100644
--- a/spring security integration test/src/test/java/com/metaxiii/fr/controller/SecuredControllerSpringBootIntegrationTest.java
+++ b/spring security integration test/src/test/java/com/metaxiii/fr/controller/SecuredControllerSpringBootIntegrationTest.java
@@ -8,28 +8,37 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
+@AutoConfigureMockMvc
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class SecuredControllerSpringBootIntegrationTest {
@Autowired
private WebApplicationContext context;
+ @Autowired
private MockMvc mvc;
- @BeforeEach
- public void setup() {
- mvc = MockMvcBuilders.webAppContextSetup(context).apply(springSecurity()).build();
- }
-
- @WithMockUser("spring")
@Test
+ @WithMockUser("spring")
void givenAuthRequestOnPrivateService_shouldSucceedWith200() throws Exception {
mvc.perform(get("/private/hello").contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk());
}
+
+ @Test
+ @WithMockUser(roles = "NO_ROLE")
+ void givenAuthRequestOnPrivateService_shouldSucceedWith401() throws Exception {
+ mvc.perform(get("/private/hello").contentType(MediaType.APPLICATION_JSON)).andExpect(status().isForbidden());
+ }
+
+ @BeforeEach
+ void setup() {
+ mvc = MockMvcBuilders.webAppContextSetup(context).apply(springSecurity()).build();
+ }
}
diff --git a/spring security integration test/src/test/java/com/metaxiii/fr/controller/SecuredControllerTest.java b/spring security integration test/src/test/java/com/metaxiii/fr/controller/SecuredControllerTest.java
deleted file mode 100644
index cfb00069..00000000
--- a/spring security integration test/src/test/java/com/metaxiii/fr/controller/SecuredControllerTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.metaxiii.fr.controller;
-
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
-import org.springframework.http.MediaType;
-import org.springframework.security.test.context.support.WithMockUser;
-import org.springframework.test.web.servlet.MockMvc;
-
-@WebMvcTest(SecuredController.class)
-class SecuredControllerTest {
-
- @Autowired
- private MockMvc mockMvc;
-
- @Test
- @WithMockUser(value = "none")
- void givenAuthRequestOnPublicService_shouldSucceedWith200() throws Exception {
- mockMvc.perform(get("/public/hello").contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk());
- }
-
- @Test
- void givenRequestOnPrivateService_shouldFailWith401() throws Exception {
- mockMvc.perform(get("/private/hello").contentType(MediaType.APPLICATION_JSON)).andExpect(status().isUnauthorized());
- }
-
- @WithMockUser(value = "spring")
- @Test
- void givenAuthRequestOnPrivateService_shouldSucceedWith200() throws Exception {
- mockMvc.perform(get("/private/hello").contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk());
- }
-}
diff --git a/spring-boot-start/pom.xml b/spring-boot-start/pom.xml
index bf763f79..a51a5d3a 100644
--- a/spring-boot-start/pom.xml
+++ b/spring-boot-start/pom.xml
@@ -1,105 +1,110 @@
-
-
- 4.0.0
-
- com.metaxiii.fr
- parent
- 1.0-SNAPSHOT
-
-
- spring-boot-start
- 1.0-SNAPSHOT
- spring-boot-start
- spring-boot-start
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-thymeleaf
-
-
- com.h2database
- h2
- runtime
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.springframework.boot
- spring-boot-starter-security
-
-
- org.projectlombok
- lombok
-
-
- io.rest-assured
- rest-assured
- test
-
-
- org.mapstruct
- mapstruct
- 1.6.3
-
-
- org.mapstruct
- mapstruct-processor
- 1.6.3
-
-
- org.springframework.security
- spring-security-test
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.14.1
-
- ${java.version}
- ${java.version}
- ${java.version}
-
-
- org.projectlombok
- lombok
- ${lombok.version}
-
-
- org.mapstruct
- mapstruct-processor
- 1.6.3
-
-
- org.projectlombok
- lombok-mapstruct-binding
- 0.2.0
-
-
-
-
- -Amapstruct.defaultComponentModel=spring
-
-
-
-
-
-
-
-
+
+
+ 4.0.0
+
+ com.metaxiii.fr
+ parent
+ 1.0-SNAPSHOT
+
+
+ spring-boot-start
+ 1.0-SNAPSHOT
+ spring-boot-start
+ spring-boot-start
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+ com.h2database
+ h2
+ runtime
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.projectlombok
+ lombok
+
+
+ io.rest-assured
+ rest-assured
+ test
+ 5.5.6
+
+
+ org.mapstruct
+ mapstruct
+ 1.6.3
+
+
+ org.mapstruct
+ mapstruct-processor
+ 1.6.3
+
+
+ org.springframework.security
+ spring-security-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-webmvc-test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.14.1
+
+ ${java.version}
+ ${java.version}
+ ${java.version}
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
+ org.mapstruct
+ mapstruct-processor
+ 1.6.3
+
+
+ org.projectlombok
+ lombok-mapstruct-binding
+ 0.2.0
+
+
+
+
+ -Amapstruct.defaultComponentModel=spring
+
+
+
+
+
+
+
+
diff --git a/spring-boot-start/src/main/java/com/metaxiii/fr/Application.java b/spring-boot-start/src/main/java/com/metaxiii/fr/Application.java
index 109f1d25..fc72a741 100644
--- a/spring-boot-start/src/main/java/com/metaxiii/fr/Application.java
+++ b/spring-boot-start/src/main/java/com/metaxiii/fr/Application.java
@@ -2,15 +2,15 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.boot.persistence.autoconfigure.EntityScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-@EnableJpaRepositories("com.metaxiii.fr.repository")
-@EntityScan("com.metaxiii.fr.entity")
@SpringBootApplication
+@EntityScan("com.metaxiii.fr.entity")
+@EnableJpaRepositories("com.metaxiii.fr.repository")
public class Application {
- public static void main(String[] args) {
+ public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}
}
diff --git a/spring-boot-start/src/main/java/com/metaxiii/fr/dto/BookDTO.java b/spring-boot-start/src/main/java/com/metaxiii/fr/dto/BookDTO.java
index 597e1d5d..56af3efe 100644
--- a/spring-boot-start/src/main/java/com/metaxiii/fr/dto/BookDTO.java
+++ b/spring-boot-start/src/main/java/com/metaxiii/fr/dto/BookDTO.java
@@ -1,5 +1,6 @@
package com.metaxiii.fr.dto;
+import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@@ -7,6 +8,7 @@
@Builder
@Getter
@Setter
+@AllArgsConstructor
public class BookDTO {
private Long id;
diff --git a/spring-boot-start/src/test/java/com/metaxiii/fr/controller/BookControllerTest.java b/spring-boot-start/src/test/java/com/metaxiii/fr/controller/BookControllerTest.java
index a1ff023e..e6cdb388 100644
--- a/spring-boot-start/src/test/java/com/metaxiii/fr/controller/BookControllerTest.java
+++ b/spring-boot-start/src/test/java/com/metaxiii/fr/controller/BookControllerTest.java
@@ -1,7 +1,7 @@
package com.metaxiii.fr.controller;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
@@ -10,23 +10,22 @@
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.metaxiii.fr.entity.Book;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
+import tools.jackson.core.type.TypeReference;
+import tools.jackson.databind.json.JsonMapper;
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class BookControllerTest {
private static final String API_ROOT = "/api/books";
@@ -34,57 +33,82 @@ public class BookControllerTest {
@Autowired
private MockMvc mockMvc;
- private static Book getBook(final MvcResult mvcResult) throws JsonProcessingException, UnsupportedEncodingException {
- return new ObjectMapper().readValue(mvcResult.getResponse().getContentAsString(), Book.class);
+ @Test
+ void itshouldThrowsBookMismatchExceptionWhenUpdateHasDifferentBookIdAndId() throws Exception {
+ final Book book = createRandomBook();
+ final String location = createBookAsUri(book);
+ book.setId(Long.valueOf(RandomStringUtils.secure().nextNumeric(6)));
+ book.setAuthor("newAuthor");
+ mockMvc
+ .perform(
+ put(API_ROOT + location).with(csrf()).content(ObjectToJson(book)).contentType(MediaType.APPLICATION_JSON)
+ )
+ .andDo(print())
+ .andExpect(status().isBadRequest());
}
- public static String ObjectToJson(final Book obj) {
- try {
- return new ObjectMapper().writeValueAsString(obj);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ @Test
+ void whenCreateNewBook_thenCreated() throws Exception {
+ final Book book = createRandomBook();
+ mockMvc
+ .perform(post(API_ROOT).with(csrf()).content(ObjectToJson(book)).contentType(MediaType.APPLICATION_JSON))
+ .andDo(print())
+ .andExpect(status().isCreated());
}
@Test
- void whenGetAllBooks_thenOK() throws Exception {
- mockMvc.perform(get(API_ROOT).with(csrf())).andDo(print()).andExpect(status().isOk());
+ void whenDeleteCreatedBook_thenOk() throws Exception {
+ final Book book = createRandomBook();
+ final String location = createBookAsUri(book);
+ mockMvc.perform(delete(API_ROOT + location).with(csrf())).andDo(print()).andExpect(status().isOk());
+ mockMvc.perform(get(API_ROOT + location)).andDo(print()).andExpect(status().isNotFound());
}
@Test
- void whenInvalidBook_thenError() throws Exception {
- Book book = createRandomBook();
- book.setAuthor(null);
- mockMvc
- .perform(post(API_ROOT).with(csrf()).content(ObjectToJson(book)).contentType(MediaType.APPLICATION_JSON))
- .andDo(print())
- .andExpect(status().isBadRequest());
+ void whenGetAllBooks_thenOK() throws Exception {
+ mockMvc.perform(get(API_ROOT).with(csrf())).andDo(print()).andExpect(status().isOk());
}
@Test
void whenGetBooksByTitle_thenOK() throws Exception {
- Book book = createRandomBook();
+ final Book book = createRandomBook();
createBookAsUri(book);
final MvcResult mvcResult = mockMvc
.perform(get(API_ROOT + "/title/" + book.getTitle()).with(csrf()))
.andDo(print())
.andExpect(status().isOk())
.andReturn();
- List bookReturn = new ObjectMapper()
- .readValue(mvcResult.getResponse().getContentAsString(), new TypeReference<>() {});
- assertTrue(bookReturn.size() > 0);
+ final List bookReturn = new JsonMapper().readValue(
+ mvcResult.getResponse().getContentAsString(),
+ new TypeReference<>() {}
+ );
+ assertFalse(bookReturn.isEmpty());
+ }
+
+ private String createBookAsUri(final Book book) throws Exception {
+ final MvcResult mvcResult = mockMvc
+ .perform(post(API_ROOT).with(csrf()).content(ObjectToJson(book)).contentType(MediaType.APPLICATION_JSON))
+ .andDo(print())
+ .andExpect(status().isCreated())
+ .andReturn();
+ final Book bookReturn = getBook(mvcResult);
+ return "/" + bookReturn.getId();
+ }
+
+ private static Book getBook(final MvcResult mvcResult) throws UnsupportedEncodingException {
+ return new JsonMapper().readValue(mvcResult.getResponse().getContentAsString(), Book.class);
}
@Test
void whenGetCreatedBookById_thenOK() throws Exception {
- Book book = createRandomBook();
- String location = createBookAsUri(book);
+ final Book book = createRandomBook();
+ final String location = createBookAsUri(book);
final MvcResult mvcResult = mockMvc
.perform(get(API_ROOT + location).with(csrf()))
.andDo(print())
.andExpect(status().isOk())
.andReturn();
- Book bookReturn = getBook(mvcResult);
+ final Book bookReturn = getBook(mvcResult);
assertEquals(book.getTitle(), bookReturn.getTitle());
}
@@ -97,18 +121,34 @@ void whenGetNotExistBookById_thenNotFound() throws Exception {
}
@Test
- void whenCreateNewBook_thenCreated() throws Exception {
- Book book = createRandomBook();
+ void whenInvalidBook_thenError() throws Exception {
+ final Book book = createRandomBook();
+ book.setAuthor(null);
mockMvc
.perform(post(API_ROOT).with(csrf()).content(ObjectToJson(book)).contentType(MediaType.APPLICATION_JSON))
.andDo(print())
- .andExpect(status().isCreated());
+ .andExpect(status().isBadRequest());
+ }
+
+ private Book createRandomBook() {
+ final Book book = new Book();
+ book.setTitle(RandomStringUtils.secure().nextNumeric(10));
+ book.setAuthor(RandomStringUtils.secure().nextNumeric(15));
+ return book;
+ }
+
+ public static String ObjectToJson(final Book obj) {
+ try {
+ return new JsonMapper().writeValueAsString(obj);
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
}
@Test
void whenUpdateCreatedBook_thenUpdated() throws Exception {
- Book book = createRandomBook();
- String location = createBookAsUri(book);
+ final Book book = createRandomBook();
+ final String location = createBookAsUri(book);
book.setId(Long.parseLong(location.substring(1)));
book.setAuthor("newAuthor");
mockMvc
@@ -122,46 +162,7 @@ void whenUpdateCreatedBook_thenUpdated() throws Exception {
.andDo(print())
.andExpect(status().isOk())
.andReturn();
- Book bookReturn = getBook(mvcResult);
+ final Book bookReturn = getBook(mvcResult);
assertEquals("newAuthor", bookReturn.getAuthor());
}
-
- @Test
- void whenDeleteCreatedBook_thenOk() throws Exception {
- Book book = createRandomBook();
- String location = createBookAsUri(book);
- mockMvc.perform(delete(API_ROOT + location).with(csrf())).andDo(print()).andExpect(status().isOk());
- mockMvc.perform(get(API_ROOT + location)).andDo(print()).andExpect(status().isNotFound());
- }
-
- @Test
- void itshouldThrowsBookMismatchExceptionWhenUpdateHasDifferentBookIdAndId() throws Exception {
- Book book = createRandomBook();
- String location = createBookAsUri(book);
- book.setId(Long.valueOf(RandomStringUtils.secure().nextNumeric(6)));
- book.setAuthor("newAuthor");
- mockMvc
- .perform(
- put(API_ROOT + location).with(csrf()).content(ObjectToJson(book)).contentType(MediaType.APPLICATION_JSON)
- )
- .andDo(print())
- .andExpect(status().isBadRequest());
- }
-
- private Book createRandomBook() {
- Book book = new Book();
- book.setTitle(RandomStringUtils.secure().nextNumeric(10));
- book.setAuthor(RandomStringUtils.secure().nextNumeric(15));
- return book;
- }
-
- private String createBookAsUri(Book book) throws Exception {
- final MvcResult mvcResult = mockMvc
- .perform(post(API_ROOT).with(csrf()).content(ObjectToJson(book)).contentType(MediaType.APPLICATION_JSON))
- .andDo(print())
- .andExpect(status().isCreated())
- .andReturn();
- Book bookReturn = getBook(mvcResult);
- return "/" + bookReturn.getId();
- }
}
diff --git a/spring-boot-start/src/test/java/com/metaxiii/fr/controller/SimpleControllerTest.java b/spring-boot-start/src/test/java/com/metaxiii/fr/controller/SimpleControllerTest.java
index 65a32c02..e8e7d756 100644
--- a/spring-boot-start/src/test/java/com/metaxiii/fr/controller/SimpleControllerTest.java
+++ b/spring-boot-start/src/test/java/com/metaxiii/fr/controller/SimpleControllerTest.java
@@ -6,8 +6,8 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
import org.springframework.test.web.servlet.MockMvc;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
diff --git a/spring-data-get-last-record/pom.xml b/spring-data-get-last-record/pom.xml
index 43d93195..a5e894a5 100644
--- a/spring-data-get-last-record/pom.xml
+++ b/spring-data-get-last-record/pom.xml
@@ -1,30 +1,34 @@
-
-
- 4.0.0
-
- com.metaxiii.fr
- parent
- 1.0-SNAPSHOT
-
- spring-data-get-last-record
- 0.0.1-SNAPSHOT
- spring-data-get-last-record
- spring-data-get-last-record
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- com.h2database
- h2
- runtime
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
+
+
+ 4.0.0
+
+ com.metaxiii.fr
+ parent
+ 1.0-SNAPSHOT
+
+ spring-data-get-last-record
+ 0.0.1-SNAPSHOT
+ spring-data-get-last-record
+ spring-data-get-last-record
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ com.h2database
+ h2
+ runtime
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-data-jpa-test
+
+
+
diff --git a/spring-data-get-last-record/src/test/java/com/metaxiii/fr/springdatagetlastrecord/repository/PostServiceTest.java b/spring-data-get-last-record/src/test/java/com/metaxiii/fr/springdatagetlastrecord/repository/PostServiceTest.java
index f639dcfc..2c527515 100644
--- a/spring-data-get-last-record/src/test/java/com/metaxiii/fr/springdatagetlastrecord/repository/PostServiceTest.java
+++ b/spring-data-get-last-record/src/test/java/com/metaxiii/fr/springdatagetlastrecord/repository/PostServiceTest.java
@@ -6,7 +6,7 @@
import com.metaxiii.fr.springdatagetlastrecord.entity.Post;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
+import org.springframework.boot.data.jpa.test.autoconfigure.DataJpaTest;
import org.springframework.test.context.jdbc.Sql;
@DataJpaTest
@@ -18,21 +18,21 @@ class PostServiceTest {
@Test
void givenPosts_whenUsingQueryAnnotation_thenReturnLastPost() {
- Post post = repository.findLastPost();
+ final Post post = repository.findLastPost();
assertNotNull(post);
assertEquals(5, post.getId());
}
@Test
void itShouldFindFirstByOrderByPublicationDateDesc() {
- Post post = repository.findFirstByOrderByPublicationDateDesc();
+ final Post post = repository.findFirstByOrderByPublicationDateDesc();
assertNotNull(post);
assertEquals(5, post.getId());
}
@Test
void itShouldFindTopByOrderByPublicationDateDesc() {
- Post post = repository.findTopByOrderByPublicationDateDesc();
+ final Post post = repository.findTopByOrderByPublicationDateDesc();
assertNotNull(post);
assertEquals(5, post.getId());
}
diff --git a/springwebclient-vs-resttemplate/pom.xml b/springwebclient-vs-resttemplate/pom.xml
index 8b1eadad..1811cf7f 100644
--- a/springwebclient-vs-resttemplate/pom.xml
+++ b/springwebclient-vs-resttemplate/pom.xml
@@ -1,31 +1,35 @@
-
-
- 4.0.0
-
- com.metaxiii.fr
- parent
- 1.0-SNAPSHOT
-
- springwebclient-vs-resttemplate
- 0.0.1-SNAPSHOT
- springwebclient-vs-resttemplate
- springwebclient-vs-resttemplate
-
-
- org.springframework.boot
- spring-boot-starter-webflux
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- io.projectreactor
- reactor-test
- test
-
-
-
+
+
+ 4.0.0
+
+ com.metaxiii.fr
+ parent
+ 1.0-SNAPSHOT
+
+ springwebclient-vs-resttemplate
+ 0.0.1-SNAPSHOT
+ springwebclient-vs-resttemplate
+ springwebclient-vs-resttemplate
+
+
+ org.springframework.boot
+ spring-boot-starter-webflux
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ io.projectreactor
+ reactor-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-webtestclient
+
+
+
diff --git a/springwebclient-vs-resttemplate/src/main/java/com/metaxiii/fr/controller/TweetController.java b/springwebclient-vs-resttemplate/src/main/java/com/metaxiii/fr/controller/TweetController.java
index b19f5441..f008d1bb 100644
--- a/springwebclient-vs-resttemplate/src/main/java/com/metaxiii/fr/controller/TweetController.java
+++ b/springwebclient-vs-resttemplate/src/main/java/com/metaxiii/fr/controller/TweetController.java
@@ -2,11 +2,12 @@
import com.metaxiii.fr.model.Tweet;
import java.net.URI;
+import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.autoconfigure.web.ServerProperties;
+import org.springframework.boot.web.server.autoconfigure.ServerProperties;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
@@ -16,6 +17,7 @@
import org.springframework.web.client.RestTemplate;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
@Slf4j
@RestController
@@ -28,36 +30,34 @@ public TweetController(final ServerProperties serverProperties) {
}
@GetMapping("/slow-service-tweets")
- public List getAllTweets() throws InterruptedException {
- Thread.sleep(2000L); // delay
- return Arrays.asList(
- new Tweet("RestTemplate rules", "@user1"),
- new Tweet("WebClient is better", "@user2"),
- new Tweet("OK, both are useful", "@user1")
- );
+ public Mono> getAllTweets() {
+ return Mono.just(
+ Arrays.asList(
+ new Tweet("RestTemplate rules", "@user1"),
+ new Tweet("WebClient is better", "@user2"),
+ new Tweet("OK, both are useful", "@user1")
+ )
+ ).delayElement(Duration.ofSeconds(1));
}
@GetMapping("/tweets-blocking")
- public List getTweetsBlocking() {
- log.info("Starting BLOCKING Controller!");
- final RestTemplate restTemplate = new RestTemplate();
- final ResponseEntity> response = restTemplate.exchange(
- URI.create("http://localhost:" + serverProperties.getPort() + "/slow-service-tweets"),
- HttpMethod.GET,
- null,
- new ParameterizedTypeReference<>() {}
- );
- final List result = Objects.requireNonNull(response.getBody());
- result.forEach(tweet -> log.info(tweet.toString()));
- log.info("Exiting BLOCKING Controller!");
- return result;
+ public Mono> getTweetsBlocking() {
+ log.info("Starting BLOCKING Controller (Fixing with WebClient)!");
+ return WebClient.create("http://localhost:" + serverProperties.getPort())
+ .get()
+ .uri("/slow-service-tweets")
+ .retrieve()
+ .bodyToMono(new ParameterizedTypeReference>() {})
+ .doOnNext(result -> {
+ result.forEach(tweet -> log.info(tweet.toString()));
+ log.info("Exiting Controller!");
+ });
}
@GetMapping(value = "/tweets-non-blocking", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux getTweetsNonBlocking() {
log.info("Starting NON-BLOCKING Controller!");
- final Flux tweetFlux = WebClient
- .create()
+ final Flux tweetFlux = WebClient.create()
.get()
.uri(URI.create("http://localhost:" + serverProperties.getPort() + "/slow-service-tweets"))
.retrieve()
diff --git a/springwebclient-vs-resttemplate/src/test/java/com/metaxiii/fr/controller/TweetControllerTest.java b/springwebclient-vs-resttemplate/src/test/java/com/metaxiii/fr/controller/TweetControllerTest.java
index 4c2893b7..8703b226 100644
--- a/springwebclient-vs-resttemplate/src/test/java/com/metaxiii/fr/controller/TweetControllerTest.java
+++ b/springwebclient-vs-resttemplate/src/test/java/com/metaxiii/fr/controller/TweetControllerTest.java
@@ -5,8 +5,8 @@
import com.metaxiii.fr.model.Tweet;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.webtestclient.autoconfigure.AutoConfigureWebTestClient;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.reactive.server.WebTestClient;
diff --git a/springwebclient-vs-resttemplate/src/test/resources/application-test.yml b/springwebclient-vs-resttemplate/src/test/resources/application-test.yml
index 3c511347..27fba366 100644
--- a/springwebclient-vs-resttemplate/src/test/resources/application-test.yml
+++ b/springwebclient-vs-resttemplate/src/test/resources/application-test.yml
@@ -1,2 +1,2 @@
-server:
- port: 9999
+server:
+ port: 9999