CtrlK
BlogDocsLog inGet started
Tessl Logo

jbaruch/spring-boot-4

Build Spring Boot 4.0 applications - project setup, REST controllers, dependency injection, configuration, actuator, and testing

91

1.79x
Quality

90%

Does it follow best practices?

Impact

97%

1.79x

Average score across 3 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-1/

Migrate E-Commerce Service to Spring Boot 4

Problem/Feature Description

Your team maintains an e-commerce order processing service that was originally built on Spring Boot 3.2. The platform team has mandated a company-wide upgrade to Spring Boot 4 before the end of the quarter to take advantage of improved performance and long-term support guarantees. Several services have already been migrated, and your service is next.

The service uses Spring MVC for its REST API, Mockito for tests, AOP for method-level logging, OAuth2 for downstream service authentication, and Jackson for JSON processing. It also uses @Nullable annotations for API null-safety contracts. You need to update the project's build file and configuration so the service compiles and runs correctly under Spring Boot 4. Provide the updated Maven pom.xml (or Gradle build.gradle.kts) and application.properties with all necessary changes applied.

Output Specification

Produce an updated build descriptor (either pom.xml or build.gradle.kts) and application.properties reflecting a correct Spring Boot 4 setup. Where relevant, also show any updated Java source file snippets demonstrating corrected annotation usage.

The output should:

  • Be a complete, runnable configuration (not just a diff)
  • Include all dependency and plugin changes needed for Spring Boot 4
  • Reflect updated property keys in application.properties
  • Show corrected annotation imports in at least one Java class

Input Files (optional)

pom.xml (before migration)

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>order-service</artifactId>
  <version>1.0.0</version>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.2.4</version>
  </parent>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-oauth2-client</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

application.properties (before migration)

spring.application.name=order-service
server.port=8080
spring.jackson.write.indent-output=true
spring.jackson.serialization.write-dates-as-timestamps=false
management.tracing.enabled=true

OrderController.java (excerpt)

import org.springframework.lang.Nullable;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/orders")
public class OrderController {

    private final OrderService orderService;

    @Autowired
    public OrderController(OrderService orderService) {
        this.orderService = orderService;
    }

    @GetMapping("/{id}")
    public ResponseEntity<Order> getOrder(@PathVariable Long id) {
        return orderService.findById(id)
            .map(ResponseEntity::ok)
            .orElse(ResponseEntity.notFound().build());
    }
}

OrderServiceTest.java (excerpt)

import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.web.servlet.MockMvc;

@SpringBootTest
public class OrderServiceTest {

    @Autowired
    private MockMvc mockMvc;

    @MockBean
    private OrderService orderService;
}

evals

scenario-1

criteria.json

task.md

tile.json