A Spring Boot 4.1.1 order service started 12 ways (plain and extracted jar, Spring AOT output, AppCDS, AOT cache trained with and without traffic, JDK 27, native image), ten interleaved rounds each, with first-request latency; 24 cache-mismatch cases; Docker layer arithmetic. Transcripts are in output/ (no docs/ folder). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TF9JWFvJSNm6HVzswzZU5a
39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
package com.ankurm.aotcache;
|
|
|
|
import java.net.URI;
|
|
|
|
import jakarta.validation.Valid;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
@RestController
|
|
public class OrderController {
|
|
|
|
private final OrderService service;
|
|
|
|
public OrderController(OrderService service) {
|
|
this.service = service;
|
|
}
|
|
|
|
@GetMapping("/ping")
|
|
public String ping() {
|
|
return "ok";
|
|
}
|
|
|
|
@PostMapping("/orders")
|
|
public ResponseEntity<Order> create(@Valid @RequestBody NewOrder body) {
|
|
Order o = service.create(body);
|
|
return ResponseEntity.created(URI.create("/orders/" + o.id())).body(o);
|
|
}
|
|
|
|
@GetMapping("/orders/{id}")
|
|
public ResponseEntity<Order> get(@PathVariable long id) {
|
|
return service.find(id).map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.notFound().build());
|
|
}
|
|
}
|