From 9c98fc8b901b25018a13a2bfac473da97aea3662 Mon Sep 17 00:00:00 2001 From: teetangh Date: Tue, 6 Jan 2026 14:40:46 +0530 Subject: [PATCH 1/2] Upgrade to Spring Boot 4.0.1 with latest dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Spring Boot: 3.5.5 → 4.0.1 - springdoc-openapi: 2.8.5 → 3.0.1 - Couchbase Java SDK: 3.7.9 → 3.10.0 - Lombok: 1.18.38 → 1.18.42 - maven-surefire-plugin: 3.5.2 → 3.5.4 - maven-failsafe-plugin: 3.5.2 → 3.5.4 - Removed spring-tx dependency (managed by Spring Boot parent) Spring Boot 4 migration changes: - Removed SecurityAutoConfiguration exclusion (class moved in Spring Boot 4) - Updated TestRestTemplate import to org.springframework.boot.resttestclient - Added @AutoConfigureTestRestTemplate annotation to test classes - Removed DataRetrievalFailureException from catch blocks (not needed with raw SDK) - Added spring-boot-starter-webmvc-test and spring-boot-starter-restclient test deps - Enabled springdoc-openapi (disabled by default in 3.x) --- pom.xml | 29 +++++++++++-------- .../quickstart/springboot/Application.java | 3 +- src/main/resources/application.properties | 8 +++-- .../controllers/AirlineIntegrationTest.java | 7 +++-- .../controllers/AirportIntegrationTest.java | 7 +++-- .../controllers/RouteIntegrationTest.java | 7 +++-- 6 files changed, 36 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index d8d1b2f..590e49d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.5.5 + 4.0.1 org.couchbase @@ -22,7 +22,7 @@ 17 3.0.0 3.0.0 - 3.7.9 + 3.10.0 4.13.2 3.0.0-M5 @@ -32,11 +32,6 @@ org.springframework.boot spring-boot-starter-logging - - org.springframework - spring-tx - 6.2.5 - org.springframework.boot spring-boot @@ -55,6 +50,16 @@ spring-boot-starter-test test + + org.springframework.boot + spring-boot-starter-webmvc-test + test + + + org.springframework.boot + spring-boot-starter-restclient + test + org.springframework.boot spring-boot-devtools @@ -74,7 +79,7 @@ org.springdoc springdoc-openapi-starter-webmvc-ui - 2.8.5 + 3.0.1 com.couchbase.client @@ -84,7 +89,7 @@ org.projectlombok lombok - 1.18.38 + 1.18.42 provided @@ -125,7 +130,7 @@ org.projectlombok lombok - 1.18.38 + 1.18.42 @@ -133,7 +138,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.5.2 + 3.5.4 org.springframework.boot @@ -164,7 +169,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.5.2 + 3.5.4 **/*IntegrationTest.java diff --git a/src/main/java/org/couchbase/quickstart/springboot/Application.java b/src/main/java/org/couchbase/quickstart/springboot/Application.java index acb0932..db12eac 100644 --- a/src/main/java/org/couchbase/quickstart/springboot/Application.java +++ b/src/main/java/org/couchbase/quickstart/springboot/Application.java @@ -5,9 +5,8 @@ import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; -@SpringBootApplication(exclude = SecurityAutoConfiguration.class, proxyBeanMethods = false) +@SpringBootApplication(proxyBeanMethods = false) public class Application implements CommandLineRunner { private static final Logger log = LoggerFactory.getLogger(Application.class); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 1fbcf40..a6c8dff 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ # Spring MVC configuration spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER -# Modern Couchbase configuration (Spring Boot 3.5+) +# Modern Couchbase configuration (Spring Boot 4.0+) spring.couchbase.connection-string=${DB_CONN_STR} spring.couchbase.username=${DB_USERNAME} spring.couchbase.password=${DB_PASSWORD} @@ -10,4 +10,8 @@ spring.couchbase.bucket.name=travel-sample # Couchbase connection optimizations spring.couchbase.env.timeouts.query=30000ms spring.couchbase.env.timeouts.key-value=5000ms -spring.couchbase.env.timeouts.connect=10000ms \ No newline at end of file +spring.couchbase.env.timeouts.connect=10000ms + +# springdoc-openapi 3.x - enable API docs (disabled by default in 3.x) +springdoc.api-docs.enabled=true +springdoc.swagger-ui.enabled=true \ No newline at end of file diff --git a/src/test/java/org/couchbase/quickstart/springboot/controllers/AirlineIntegrationTest.java b/src/test/java/org/couchbase/quickstart/springboot/controllers/AirlineIntegrationTest.java index b630125..e7cb997 100644 --- a/src/test/java/org/couchbase/quickstart/springboot/controllers/AirlineIntegrationTest.java +++ b/src/test/java/org/couchbase/quickstart/springboot/controllers/AirlineIntegrationTest.java @@ -15,9 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.resttestclient.TestRestTemplate; +import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.dao.DataRetrievalFailureException; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; @@ -30,6 +30,7 @@ @Slf4j @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@AutoConfigureTestRestTemplate class AirlineIntegrationTest { @Value("${local.server.port}") @@ -46,7 +47,7 @@ private void deleteAirline(String airlineId, String cleanupTiming) { if (airlineService.getAirlineById(airlineId) != null) { restTemplate.delete("/api/v1/airline/" + airlineId); } - } catch (DocumentNotFoundException | DataRetrievalFailureException | ResourceAccessException e) { + } catch (DocumentNotFoundException | ResourceAccessException e) { log.warn("Document " + airlineId + " not present " + cleanupTiming); } catch (Exception e) { log.debug("Cleanup: Could not delete test airline {}: {} (this is expected during test cleanup)", airlineId, e.getMessage()); diff --git a/src/test/java/org/couchbase/quickstart/springboot/controllers/AirportIntegrationTest.java b/src/test/java/org/couchbase/quickstart/springboot/controllers/AirportIntegrationTest.java index 8814487..6652bbc 100644 --- a/src/test/java/org/couchbase/quickstart/springboot/controllers/AirportIntegrationTest.java +++ b/src/test/java/org/couchbase/quickstart/springboot/controllers/AirportIntegrationTest.java @@ -16,9 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.resttestclient.TestRestTemplate; +import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.dao.DataRetrievalFailureException; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; @@ -31,6 +31,7 @@ @Slf4j @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@AutoConfigureTestRestTemplate class AirportIntegrationTest { @Value("${local.server.port}") @@ -47,7 +48,7 @@ private void deleteAirport(String airportId, String cleanupTiming) { if (airportService.getAirportById(airportId) != null) { restTemplate.delete("/api/v1/airport/" + airportId); } - } catch (DocumentNotFoundException | DataRetrievalFailureException | ResourceAccessException e) { + } catch (DocumentNotFoundException | ResourceAccessException e) { log.warn("Document " + airportId + " not present " + cleanupTiming); } catch (Exception e) { log.debug("Cleanup: Could not delete test airport {}: {} (this is expected during test cleanup)", airportId, e.getMessage()); diff --git a/src/test/java/org/couchbase/quickstart/springboot/controllers/RouteIntegrationTest.java b/src/test/java/org/couchbase/quickstart/springboot/controllers/RouteIntegrationTest.java index e9973c5..aa601c2 100644 --- a/src/test/java/org/couchbase/quickstart/springboot/controllers/RouteIntegrationTest.java +++ b/src/test/java/org/couchbase/quickstart/springboot/controllers/RouteIntegrationTest.java @@ -13,9 +13,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.resttestclient.TestRestTemplate; +import org.springframework.boot.resttestclient.autoconfigure.AutoConfigureTestRestTemplate; import org.springframework.core.ParameterizedTypeReference; -import org.springframework.dao.DataRetrievalFailureException; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; @@ -28,6 +28,7 @@ @Slf4j @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@AutoConfigureTestRestTemplate class RouteIntegrationTest { @Value("${local.server.port}") @@ -44,7 +45,7 @@ private void deleteRoute(String routeId, String cleanupTiming) { if (routeService.getRouteById(routeId) != null) { restTemplate.delete("/api/v1/route/" + routeId); } - } catch (DocumentNotFoundException | DataRetrievalFailureException | ResourceAccessException e) { + } catch (DocumentNotFoundException | ResourceAccessException e) { log.warn("Document " + routeId + " not present " + cleanupTiming); } catch (Exception e) { log.debug("Cleanup: Could not delete test route {}: {} (this is expected during test cleanup)", routeId, e.getMessage()); From 33c2fc5665f4cdadb6743d38dae70c1dfae53de5 Mon Sep 17 00:00:00 2001 From: teetangh Date: Tue, 6 Jan 2026 14:47:16 +0530 Subject: [PATCH 2/2] Centralize dependency versions in properties section - Add lombok.version property and use it in dependency and annotation processor - Add springdoc.version property and use it in springdoc-openapi dependency - Update mavensurefire.version to maven-surefire.version with value 3.5.4 - Use maven-surefire.version for both surefire and failsafe plugins (same release) - Remove unused swagger.version and springweb.version properties --- pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 590e49d..7e921c7 100644 --- a/pom.xml +++ b/pom.xml @@ -20,11 +20,11 @@ UTF-8 17 17 - 3.0.0 - 3.0.0 3.10.0 + 1.18.42 + 3.0.1 4.13.2 - 3.0.0-M5 + 3.5.4 @@ -79,7 +79,7 @@ org.springdoc springdoc-openapi-starter-webmvc-ui - 3.0.1 + ${springdoc.version} com.couchbase.client @@ -89,7 +89,7 @@ org.projectlombok lombok - 1.18.42 + ${lombok.version} provided @@ -130,7 +130,7 @@ org.projectlombok lombok - 1.18.42 + ${lombok.version} @@ -138,7 +138,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.5.4 + ${maven-surefire.version} org.springframework.boot @@ -169,7 +169,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.5.4 + ${maven-surefire.version} **/*IntegrationTest.java