diff --git a/pom.xml b/pom.xml index d8d1b2f..7e921c7 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 @@ -20,11 +20,11 @@ UTF-8 17 17 - 3.0.0 - 3.0.0 - 3.7.9 + 3.10.0 + 1.18.42 + 3.0.1 4.13.2 - 3.0.0-M5 + 3.5.4 @@ -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 + ${springdoc.version} com.couchbase.client @@ -84,7 +89,7 @@ org.projectlombok lombok - 1.18.38 + ${lombok.version} provided @@ -125,7 +130,7 @@ org.projectlombok lombok - 1.18.38 + ${lombok.version} @@ -133,7 +138,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.5.2 + ${maven-surefire.version} org.springframework.boot @@ -164,7 +169,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.5.2 + ${maven-surefire.version} **/*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());