Build Spring Boot 4.0 applications - project setup, REST controllers, dependency injection, configuration, actuator, and testing
91
90%
Does it follow best practices?
Impact
97%
1.79xAverage score across 3 eval scenarios
Passed
No known issues
Your company is launching a new product catalog microservice that will power the storefront's browsing and search experience. The service needs to expose a REST API for managing products (create, read, update, delete, and search) and must be production-ready from day one, meaning it should include observability endpoints so the platform team can monitor health, collect metrics, and wire it into the Kubernetes readiness/liveness probe system.
The service must also handle errors gracefully, returning structured error responses that front-end and API gateway consumers can parse uniformly. Use Spring Boot 4 for the implementation. Provide all relevant source files including the build descriptor, main application class, controller, service layer, exception handler, and configuration.
Produce a complete, self-contained Spring Boot 4 project that includes:
pom.xml or build.gradle.kts) with correct dependencies and Java versionsrc/main/resources/application.properties with server, actuator, and JSON configurationProductController with endpoints: GET /api/products, GET /api/products/{id}, POST /api/products, PUT /api/products/{id}, DELETE /api/products/{id}, GET /api/products/search?q={query}ProductService (interface or class) with the business logic stubGlobalExceptionHandler that handles at minimum a ProductNotFoundException and returns structured error responsesProduct model (record or class)The project should compile without errors and follow modern Spring Boot 4 conventions throughout.