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 team is building an AI inference gateway that routes requests to various language model providers. The service has several tuneable parameters (model name, timeout, max tokens, retry count, and API base URL) that differ across development, staging, and production environments. The team wants these parameters managed via structured, type-safe configuration that can be validated at startup and shared cleanly across the codebase without passing raw @Value strings everywhere.
The service also needs JSON responses to be human-readable in development (pretty-printed) and compact in production, and it must export distributed traces so the platform team can observe latency across provider calls. Finally, the team wants integration tests that spin up the full application context and use MockMvc to verify controller behavior — with certain downstream provider clients mocked out.
Provide the full implementation: build descriptor, application configuration files for at least two profiles (dev and prod), the typed configuration class, a sample controller that reads from the configuration, and at least one integration test class.
Produce the following files:
pom.xml or build.gradle.kts) with all required dependenciesapplication.properties (base/common settings)application-dev.properties (dev profile overrides, e.g., pretty-print JSON, verbose logging)application-prod.properties (production profile settings)InferenceProperties.java — a type-safe configuration class bound to the inference prefix for inference settings (provider URL, model name, max tokens, timeout, retry count) with sensible defaultsInferenceController.java — a REST controller with at least a GET /api/inference/config endpoint that returns the current configurationInferenceControllerTest.java — an integration test class that verifies the controller behavior with downstream dependencies mocked outThe code should compile cleanly and reflect current Spring Boot 4 conventions.