-
Notifications
You must be signed in to change notification settings - Fork 20
fix(deps): update dependency org.springframework.boot:spring-boot-starter-parent to v4 #1293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the WalkthroughThis pull request modernizes the HTTP client configuration and test infrastructure. It replaces individual RestClient beans with a centralized RestClientHttpServiceGroupConfigurer, adds Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Comment |
8e16cd2 to
5e15a26
Compare
5e15a26 to
3e0cd8d
Compare
3e0cd8d to
34c8864
Compare
…rter-parent to v4
34c8864 to
0213963
Compare
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. |
…ice proxy (parse JSON with ObjectMapper); update client to return raw JSON
…g product responses (disable FAIL_ON_NULL_FOR_PRIMITIVES for local mapper)
…rily when parsing products
…e safely via JsonNode to handle missing fields
…nstructing PagedResult in OrderControllerIT
|
@coderabbitai, full review |
|
@rajadilipkolli, I'll conduct a full review of this Spring Boot 4.0.0 upgrade. This is a major version update that likely includes breaking changes, API updates, and new requirements. I'll analyze all the changes comprehensively. ✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
retail-store-webapp/src/main/java/com/example/retailstore/webapp/web/controller/ProductController.java (1)
60-112: Manual JSON parsing defeats type-safe client design and creates maintainability burden.This method performs 45+ lines of manual JSON tree parsing to reconstruct
PagedResult<ProductResponse>, which:
- Reimplements what Jackson would do automatically with proper deserialization
- Is error-prone and harder to maintain (any DTO changes require updating this logic)
- Loses compile-time type safety that typed responses provide
- Has slower performance (tree model traversal vs. streaming deserialization)
- Is inconsistent with other controllers:
InventoryController(line 28) andOrderController(line 60) return typedPagedResultdirectly from their service clients without manual parsingRecommendation: Revert
CatalogServiceClient.getProducts()to returnPagedResult<ProductResponse>instead ofString, then simplify this method:PagedResult<ProductResponse> products(@RequestParam(defaultValue = "0") int page, Model model) { log.info("Fetching products for page: {}", page); try { - String json = catalogServiceClient.getProducts(page); - var root = objectMapper.readTree(json); - var dataNode = root.path("data"); - var list = new ArrayList<ProductResponse>(); - if (dataNode.isArray()) { - for (var elem : dataNode) { - Long id = elem.path("id").isNumber() ? elem.path("id").asLong() : null; - String productCode = elem.path("productCode").isMissingNode() - ? null - : elem.path("productCode").asText(null); - String productName = elem.path("productName").isMissingNode() - ? null - : elem.path("productName").asText(null); - String description = elem.path("description").isMissingNode() - ? null - : elem.path("description").asText(null); - String imageUrl = elem.path("imageUrl").isMissingNode() - || elem.path("imageUrl").isNull() - ? null - : elem.path("imageUrl").asText(null); - double price = elem.has("price") && elem.path("price").isNumber() - ? elem.path("price").asDouble(0.0) - : 0.0; - boolean inStock = - elem.has("inStock") && elem.path("inStock").isBoolean() - ? elem.path("inStock").asBoolean(false) - : false; - list.add(new ProductResponse(id, productCode, productName, description, imageUrl, price, inStock)); - } - } - - long totalElements = root.path("totalElements").isNumber() - ? root.path("totalElements").asLong() - : 0L; - int pageNumber = - root.path("pageNumber").isNumber() ? root.path("pageNumber").asInt() : 0; - int totalPages = - root.path("totalPages").isNumber() ? root.path("totalPages").asInt() : 0; - boolean isFirst = root.path("isFirst").asBoolean(false); - boolean isLast = root.path("isLast").asBoolean(false); - boolean hasNext = root.path("hasNext").asBoolean(false); - boolean hasPrevious = root.path("hasPrevious").asBoolean(false); - - return new PagedResult<>( - list, totalElements, pageNumber, totalPages, isFirst, isLast, hasNext, hasPrevious); + return catalogServiceClient.getProducts(page); } catch (Exception e) {This would also allow removing the
ObjectMapperdependency from the constructor and theArrayListimport.
♻️ Duplicate comments (2)
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/LoginControllerTest.java (1)
13-13: Verify the WebMvcTest import path.This file has the same non-standard import path as OrderControllerTest.java. Please ensure all test files use the correct Spring Boot 4.0 import path once verified.
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/InventoryControllerTest.java (1)
21-21: Verify import paths for Spring Boot 4.0.This file contains the same non-standard import paths as other test files. Verification requested in OrderControllerTest.java applies here as well.
Also applies to: 27-27
🧹 Nitpick comments (2)
retail-store-webapp/src/main/resources/application.properties (1)
1-41: Add Swagger UI endpoint configuration per coding guidelines.The coding guidelines require exposing Swagger UI endpoints at
/swagger-ui.htmlfor API documentation. While Line 11 correctly exposes all actuator endpoints, there is no explicit Swagger UI path configuration in this file.If the application uses SpringDoc OpenAPI or similar Swagger UI libraries, add an explicit configuration entry to ensure the endpoint is properly exposed:
# Swagger UI endpoint configuration springdoc.swagger-ui.path=/swagger-ui.htmlIf Swagger UI is auto-configured or configured elsewhere, ensure it remains accessible at
/swagger-ui.htmlafter the Spring Boot 4.0.0 upgrade.retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/RegistrationControllerTest.java (1)
57-60: Optionally replace fully qualified customer DTO types with imports for readabilityLines 57–60 and 77–80 use fully qualified names (
com.example.retailstore.webapp.clients.customer.CustomerRequest/CustomerResponse) instead of imports. To align with the project guideline of using imports rather than FQCNs, you could simplify these references:@@ -import com.example.retailstore.webapp.clients.customer.CustomerServiceClient; +import com.example.retailstore.webapp.clients.customer.CustomerServiceClient; +import com.example.retailstore.webapp.clients.customer.CustomerRequest; +import com.example.retailstore.webapp.clients.customer.CustomerResponse; @@ - when(customerServiceClient.getOrCreateCustomer( - any(com.example.retailstore.webapp.clients.customer.CustomerRequest.class))) - .thenReturn(new com.example.retailstore.webapp.clients.customer.CustomerResponse( + when(customerServiceClient.getOrCreateCustomer(any(CustomerRequest.class))) + .thenReturn(new CustomerResponse( 1L, TEST_USERNAME, TEST_EMAIL, "9848022334", "junitAddress", 10_000)); @@ - when(customerServiceClient.getOrCreateCustomer( - any(com.example.retailstore.webapp.clients.customer.CustomerRequest.class))) - .thenReturn(new com.example.retailstore.webapp.clients.customer.CustomerResponse( + when(customerServiceClient.getOrCreateCustomer(any(CustomerRequest.class))) + .thenReturn(new CustomerResponse( 1L, TEST_USERNAME, TEST_EMAIL, "9848022334", "junitAddress", 0));Also applies to: 77-80
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
retail-store-webapp/pom.xmlis excluded by!**/*.xml
📒 Files selected for processing (20)
retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/ClientsConfig.java(1 hunks)retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/PagedResult.java(1 hunks)retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/catalog/CatalogServiceClient.java(1 hunks)retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/customer/CustomerServiceClient.java(1 hunks)retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/inventory/InventoryServiceClient.java(1 hunks)retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/order/OrderServiceClient.java(1 hunks)retail-store-webapp/src/main/java/com/example/retailstore/webapp/config/WebConfig.java(1 hunks)retail-store-webapp/src/main/java/com/example/retailstore/webapp/exception/ResourceNotFoundException.java(1 hunks)retail-store-webapp/src/main/java/com/example/retailstore/webapp/web/controller/ProductController.java(4 hunks)retail-store-webapp/src/main/resources/application.properties(2 hunks)retail-store-webapp/src/test/java/com/example/retailstore/webapp/common/AbstractIntegrationTest.java(2 hunks)retail-store-webapp/src/test/java/com/example/retailstore/webapp/common/ContainerConfig.java(1 hunks)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/InventoryControllerTest.java(2 hunks)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/LoginControllerTest.java(1 hunks)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/OrderControllerIT.java(3 hunks)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/OrderControllerTest.java(1 hunks)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerIT.java(2 hunks)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerTest.java(3 hunks)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/RegistrationControllerIT.java(7 hunks)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/RegistrationControllerTest.java(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.java
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.java: Use imports rather than fully qualified class names in code
Runspotless:applyafter any formatting rule changes to maintain consistent code style
Files:
retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/order/OrderServiceClient.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/common/ContainerConfig.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/inventory/InventoryServiceClient.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/RegistrationControllerIT.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/config/WebConfig.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/PagedResult.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/LoginControllerTest.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/customer/CustomerServiceClient.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/ClientsConfig.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/catalog/CatalogServiceClient.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerIT.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/RegistrationControllerTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/common/AbstractIntegrationTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/OrderControllerIT.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/exception/ResourceNotFoundException.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/OrderControllerTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerTest.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/web/controller/ProductController.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/InventoryControllerTest.java
**/src/main/java/**/*.java
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Search for
@KafkaListener,@KafkaTemplate, andtopicconstants in service source code to verify event contracts and Kafka message producers/consumers
Files:
retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/order/OrderServiceClient.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/inventory/InventoryServiceClient.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/config/WebConfig.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/PagedResult.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/customer/CustomerServiceClient.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/ClientsConfig.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/catalog/CatalogServiceClient.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/exception/ResourceNotFoundException.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/web/controller/ProductController.java
**/*.{properties,yml,yaml}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use the
localSpring profile when running services against Dockerized infrastructure (e.g.,-Dspring-boot.run.profiles=local)
Files:
retail-store-webapp/src/main/resources/application.properties
**/src/main/resources/application*.{properties,yml,yaml}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Expose actuator endpoints under
/actuatorand Swagger UI endpoints at/swagger-ui.htmlfor observability and API documentation
Files:
retail-store-webapp/src/main/resources/application.properties
**/*Test.java
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*Test.java: Use AssertJ for assertions in all test files
Run unit tests for a specific module before merging changes using./mvnw -pl <module> test(Unix) or.mvnw.cmd -pl <module> test(Windows)
Files:
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/LoginControllerTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/RegistrationControllerTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/common/AbstractIntegrationTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/OrderControllerTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/InventoryControllerTest.java
**/src/main/java/**/controller/**/*.java
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Update API controllers and DTOs in the same module when changing a service API
Files:
retail-store-webapp/src/main/java/com/example/retailstore/webapp/web/controller/ProductController.java
🧠 Learnings (4)
📚 Learning: 2025-12-01T03:54:08.848Z
Learnt from: CR
Repo: rajadilipkolli/spring-boot-microservices-series-v2 PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T03:54:08.848Z
Learning: Applies to **/src/main/java/**/controller/**/*.java : Update API controllers and DTOs in the same module when changing a service API
Applied to files:
retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/order/OrderServiceClient.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/RegistrationControllerIT.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/LoginControllerTest.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/customer/CustomerServiceClient.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerIT.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/RegistrationControllerTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/common/AbstractIntegrationTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/OrderControllerIT.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/OrderControllerTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerTest.javaretail-store-webapp/src/main/java/com/example/retailstore/webapp/web/controller/ProductController.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/InventoryControllerTest.java
📚 Learning: 2025-12-01T03:54:08.848Z
Learnt from: CR
Repo: rajadilipkolli/spring-boot-microservices-series-v2 PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T03:54:08.848Z
Learning: Applies to **/src/main/resources/application*.{properties,yml,yaml} : Expose actuator endpoints under `/actuator` and Swagger UI endpoints at `/swagger-ui.html` for observability and API documentation
Applied to files:
retail-store-webapp/src/main/resources/application.properties
📚 Learning: 2025-12-01T03:54:08.848Z
Learnt from: CR
Repo: rajadilipkolli/spring-boot-microservices-series-v2 PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T03:54:08.848Z
Learning: Applies to **/*Test.java : Use AssertJ for assertions in all test files
Applied to files:
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/LoginControllerTest.javaretail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/InventoryControllerTest.java
📚 Learning: 2025-12-01T03:54:08.848Z
Learnt from: CR
Repo: rajadilipkolli/spring-boot-microservices-series-v2 PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T03:54:08.848Z
Learning: Spring Boot microservices architecture comprises: API Gateway (single entry point), Service Registry (Eureka), Config Server, domain services (catalog, inventory, order, payment), UI (Thymeleaf), and asynchronous Kafka messaging
Applied to files:
retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/ClientsConfig.java
🧬 Code graph analysis (5)
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/LoginControllerTest.java (2)
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerTest.java (1)
WebMvcTest(36-175)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/InventoryControllerTest.java (1)
WebMvcTest(29-149)
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/RegistrationControllerTest.java (3)
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerTest.java (1)
WebMvcTest(36-175)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/InventoryControllerTest.java (1)
WebMvcTest(29-149)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/OrderControllerTest.java (1)
WebMvcTest(47-261)
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerTest.java (2)
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/InventoryControllerTest.java (1)
WebMvcTest(29-149)retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/OrderControllerTest.java (1)
WebMvcTest(47-261)
retail-store-webapp/src/main/java/com/example/retailstore/webapp/web/controller/ProductController.java (2)
retail-store-webapp/src/main/java/com/example/retailstore/webapp/web/controller/InventoryController.java (1)
Controller(20-75)retail-store-webapp/src/main/java/com/example/retailstore/webapp/web/controller/OrderController.java (1)
Controller(26-107)
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/InventoryControllerTest.java (1)
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/LoginControllerTest.java (1)
WebMvcTest(19-45)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (26)
retail-store-webapp/src/main/java/com/example/retailstore/webapp/exception/ResourceNotFoundException.java (1)
12-14: LGTM! Modern Java idiom.The use of
String.formatted(...)is a more concise and idiomatic approach in modern Java (15+). This change is functionally equivalent to the previous implementation and aligns well with the Spring Boot 4.x upgrade.retail-store-webapp/src/test/java/com/example/retailstore/webapp/common/ContainerConfig.java (1)
11-11: Keycloak test image bump looks fine; verify container startup with 26.4.7This is a clean, localized change: only the
KEYCLOAK_IMAGEconstant is updated, and all usage goes throughnew KeycloakContainer(KEYCLOAK_IMAGE), so there’s no code‑side regression visible here. The only remaining concern is runtime compatibility (admin credentials, realm import behavior) of the26.4.7image versus the previous one, which CI or a quick local test should confirm.Please confirm that the Keycloak testcontainer still starts successfully and imports
retailstore-realm.jsonwithout errors under the new26.4.7image (e.g., via your existing test suite run).retail-store-webapp/src/main/resources/application.properties (2)
35-36: The HTTP client configuration property names are correct for Spring Boot 4.0.0.The properties
spring.http.clients.read-timeoutandspring.http.clients.connect-timeout(plural "clients") are the correct property names in Spring Boot 4.0.0, and the Duration values (PT10S and PT5S) use the valid ISO-8601 format. No changes are needed for these lines.However, per the coding guidelines for
**/src/main/resources/application*.{properties,yml,yaml}, this file should also expose Swagger UI endpoints at/swagger-ui.html. The Swagger UI configuration is missing and should be added to comply with observability and API documentation requirements.
13-13: The tracing configuration property is correct for Spring Boot 4.0.0.The
management.tracing.export.enabled=falseproperty on line 13 is the correct replacement for the deprecatedmanagement.tracing.enabledproperty in Spring Boot 4.0.0. The property name and syntax are valid. The actuator endpoints are properly exposed under/actuatorvia the existingmanagement.endpoints.web.exposure.include=*configuration.retail-store-webapp/src/main/java/com/example/retailstore/webapp/config/WebConfig.java (1)
3-16: JSpecify@NonNullannotation is correctly applied and consistent with codebase migrationThe import and usage of
org.jspecify.annotations.NonNullon theCorsRegistryparameter is correct. The codebase has already been fully migrated to JSpecify annotations across all 11 Java configuration and service files; no legacyjavax.annotation,jakarta.annotation, ororg.springframework.langnullability annotations remain.retail-store-webapp/src/test/java/com/example/retailstore/webapp/common/AbstractIntegrationTest.java (2)
9-9: Verify the AutoConfigureMockMvc import path for Spring Boot 4.0.Similar to the WebMvcTest import issue, the import path
org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvcappears non-standard. Please verify this is the correct package for Spring Boot 4.0.
14-24: Good migration to JsonMapper.The change from
ObjectMappertoJsonMapperis appropriate for Jackson 3.x.JsonMapperis the JSON-specific implementation and is the recommended type when working exclusively with JSON data.retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/RegistrationControllerIT.java (2)
17-17: Jackson 3.x exception hierarchy update.The change from
JsonProcessingExceptiontoJacksonExceptionis appropriate for Jackson 3.x, whereJacksonExceptionis the base exception type. This provides broader exception coverage.Also applies to: 32-32
51-51: Consistent JsonMapper usage.The migration from
objectMappertojsonMapperis consistent with the field type change inAbstractIntegrationTestand aligns with Jackson 3.x best practices.Also applies to: 54-54, 60-60, 85-85, 117-117, 142-142, 167-167
retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/order/OrderServiceClient.java (1)
10-10: Good use of @HttpExchange for declarative HTTP clients.The addition of
@HttpExchange("/order-service")is appropriate for Spring Boot 4.0's declarative HTTP interface support (Spring Framework 6.1+). This centralizes the base URL configuration and simplifies client setup.Also applies to: 13-13
retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/inventory/InventoryServiceClient.java (1)
8-8: Consistent HTTP interface client pattern.The
@HttpExchangeannotation follows the same pattern as OrderServiceClient, providing a clean, declarative approach to HTTP client configuration in Spring Boot 4.0.Also applies to: 11-11
retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/OrderControllerIT.java (2)
47-47: Consistent JsonMapper migration.All
objectMapperreferences correctly updated tojsonMapper, consistent with the parent classAbstractIntegrationTestchanges.Also applies to: 54-54, 59-59, 84-84, 90-90, 114-114
108-108: No action required—0L correctly matches the Long totalElements parameter.The PagedResult class uses
Long(wrapper type) for the totalElements parameter. The code at line 108 correctly uses0Las a Long literal, which is consistent with all other explicit PagedResult instantiations across the codebase (e.g.,2L,3L,1Lin test files). Using0(primitive int) would cause a type mismatch.retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/OrderControllerTest.java (1)
37-37: The import path is correct for Spring Boot 4.0.The import
org.springframework.boot.webmvc.test.autoconfigure.WebMvcTestis the correct path for Spring Boot 4.0. In this version, Spring Boot restructured its test dependencies and modularized the testing infrastructure. The package path you suggested (org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest) was used in Spring Boot 2/3 but is no longer valid for Spring Boot 4.0. The current import is consistent across the test suite and requires thespring-boot-starter-webmvc-testdependency.Likely an incorrect or invalid review comment.
retail-store-webapp/src/main/java/com/example/retailstore/webapp/web/controller/ProductController.java (2)
9-9: LGTM! Framework upgrade changes applied correctly.The import path change from
com.fasterxml.jacksontotools.jacksonaligns with the Jackson 3.x upgrade in Spring Boot 4.0.0, and the constructor injection pattern for both dependencies is appropriate.Also applies to: 20-20, 26-27, 29-31
48-56: LGTM!The delegation to
catalogServiceClient.createProduct()is straightforward and maintains proper error handling.retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerIT.java (3)
86-87: LGTM!The explicit null assertion for
imageUrlis appropriate given the test data doesn't provide this field.
93-93: LGTM! Method signature simplified.Removing the
throws Exceptionclause is appropriate since the test framework handles exceptions thrown from test methods.
121-121:jsonMapperis available in the test context.The field is properly defined as
protected JsonMapper jsonMapperinAbstractIntegrationTestand autowired at line 24.ProductControllerITinherits this field and can use it directly. No issues found.retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/ProductControllerTest.java (2)
26-26: LGTM! Framework upgrade imports applied correctly.The import path changes reflect Spring Boot 4.0.0 and Jackson 3.x upgrades:
WebMvcTestmoved toorg.springframework.boot.webmvc.test.autoconfigureObjectMappermoved totools.jackson.databindAlso applies to: 34-34
47-47: Test correctly updated for new API contract.The test properly mocks
CatalogServiceClient.getProducts()to return a JSON string (usingobjectMapper.writeValueAsString(pagedResult)), which is consistent with the updated service client signature.However, this test is coupled to the manual JSON parsing approach in
ProductController.products()(lines 63-107). If the recommendation to revert to typed responses is adopted, these mocks should also be updated to returnPagedResult<ProductResponse>directly.Also applies to: 103-103, 126-126
retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/catalog/CatalogServiceClient.java (1)
6-6: LGTM! Base path annotation aligns with centralized HTTP client configuration.The
@HttpExchange("/catalog-service")annotation correctly establishes the base path for catalog service endpoints, consistent with the new@ImportHttpServicesconfiguration inClientsConfig.Also applies to: 9-9
retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/ClientsConfig.java (2)
13-14: LGTM! Centralized HTTP service registration improves maintainability.The
@ImportHttpServicesannotation with explicit service client listing provides clear visibility of all HTTP clients in one place, and the new imports support the group-based configuration approach.Also applies to: 17-22
26-35: LGTM! Group-based configuration centralizes client setup.The
RestClientHttpServiceGroupConfigurerapproach cleanly applies common settings (base URL, headers, observation registry) to all HTTP service clients, eliminating the need for individual bean definitions. This is a best practice for Spring Boot 4.0.0.retail-store-webapp/src/main/java/com/example/retailstore/webapp/clients/PagedResult.java (1)
8-14: Document the rationale for wrapper types and consider null safety.The change from primitive types to wrapper types (e.g.,
long→Long,boolean→Boolean) introduces nullability where it wasn't possible before. This changes the contract ofPagedResultand requires callers to handle potential null values.Please clarify:
- Is this change required for Jackson 3.x / Spring Boot 4.0.0 compatibility?
- Are there specific serialization scenarios where nulls are expected?
If wrapper types aren't strictly necessary, consider:
- Reverting to primitives for better null safety
- Or adding
@NonNullannotations to document that nulls shouldn't occur- Or providing default values in a secondary constructor
Search for documentation on Jackson 3.x record serialization requirements:
Does Jackson 3.x require wrapper types for record fields in Java?retail-store-webapp/src/test/java/com/example/retailstore/webapp/web/controller/RegistrationControllerTest.java (1)
19-30: Import updates to Spring Boot 4 and Jackson 3 are correct, but test lacks AssertJ assertions per guidelinesThe new imports on lines 21 and 27 correctly target Spring Boot 4's test module and Jackson 3:
org.springframework.boot.webmvc.test.autoconfigure.WebMvcTesttools.jackson.databind.ObjectMapperHowever, the test violates two coding guidelines:
Use AssertJ for assertions: This test file uses hamcrest matchers (
is(),jsonPath()) instead of AssertJ. All test files must use AssertJ per coding guidelines.Avoid fully qualified class names: Lines 58–60 and 78–80 use FQCNs for
com.example.retailstore.webapp.clients.customer.CustomerRequestandcom.example.retailstore.webapp.clients.customer.CustomerResponseinstead of importing them.Add AssertJ imports and assertions, replace hamcrest matchers with AssertJ equivalents, and import the customer DTOs.
Note: An old Jackson 2 import (
com.fasterxml.jackson.databind.ObjectMapper) still exists ingatling-tests/src/test/java/simulation/BaseSimulation.javaand should be updated to the Jackson 3 style.⛔ Skipped due to learnings
Learnt from: CR Repo: rajadilipkolli/spring-boot-microservices-series-v2 PR: 0 File: .github/copilot-instructions.md:0-0 Timestamp: 2025-12-01T03:54:08.848Z Learning: Applies to **/*Test.java : Use AssertJ for assertions in all test files
This PR contains the following updates:
3.5.8->4.0.0Release Notes
spring-projects/spring-boot (org.springframework.boot:spring-boot-starter-parent)
v4.0.0Compare Source
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.