anantbhandarkar/make-it-right/mir-backend-jvm-spring
Claude Code and agent skill by anantbhandarkar/make-it-right
- community
Checking that the SKILL.md file is still in the repository.
Make It Right (Spring Boot module). Spring Boot 4.x / Framework 7 + Spring Data JPA/Hibernate + Spring Security 7 + MVC/WebFlux footguns. Covers: @Transactional self-invocation (a same-bean call bypasses the proxy, so no transaction), checked exceptions not rolling back by default, JPA/Hibernate N+1 and LazyInitializationException plus the open-in-view default, @Async on Boot's auto-configured applicationTaskExecutor (unbounded queue, swallowed exceptions, spring.threads.virtual.enabled), the Jackson 3 and Boot 3.x-to-4 migration cliff, @Valid + DTOs against overposting, and Spring Security object-level authorization plus the current authorization-bypass advisories (NimbusJwtDecoder issuer validation, method security on parameterized types, Actuator health-group paths, versioned static-resource path traversal). Chains: mir-backend (gates) -> mir-backend-jvm (JVM runtime) -> this, which adds only Spring library mechanics. TRIGGER only when the JVM backend stack is Spring Boot — building, reviewing, or debugging a controller, service, @Transactional method, JPA entity, Spring Security config, Actuator exposure, or @Async task. SKIP for Quarkus (mir-backend-jvm-quarkus), Micronaut (mir-backend-jvm-micronaut), Vert.x, Helidon, Ktor, every other non-Spring JVM framework, and every non-JVM runtime.
Install
npx vskill@latest install anantbhandarkar/make-it-right/mir-backend-jvm-springSKILL.md
The same SKILL.md was published earlier as anantbhandarkar/make-it-right/mir-backend-jvm-spring.
/mir-backend-jvm-spring · Make It Right (Spring Boot)
Bottom tier of the chain: mir-backend (generic gates) → mir-backend-jvm (JVM runtime model) → this (Spring Boot / Spring Data library mechanics). Run the gates first; load the JVM runtime tier for threading, GC, and container-heap concerns; reach for this at Gate 5 (design mechanics), Gate 6 (implementation), and Gate 7 review. Runtime-level concerns (virtual-thread pinning, pool sizing, GC tuning, `-XX:MaxRAMPercentage`, ThreadLocal hygiene) live in `mir-backend-jvm` — not here.
Stack assumed: Spring Boot 4.x · Spring Framework 7 · Spring Security 7 · Spring Data JPA (Hibernate 7.x, the version Boot 4 manages) · Spring MVC or WebFlux · PostgreSQL / MySQL. Notes call out WebFlux divergences explicitly.
Version and support status, verified 13 Aug 2026:
| Line | Status | Consequence | |
|---|---|---|---|
| Spring Boot 4.1 | Current. Released 30 Jun 2026; OSS support to 31 Jul 2027 | Target for new work | |
| Spring Boot 4.0 | Released 30 Nov 2025; OSS support ends 31 Dec 2026 | Plan the 4.1 bump now | |
| Spring Boot 3.5 | OSS support ended 30 Jun 2026 (last OSS release 3.5.16). Commercial support to Jun 2032 | No free patches — new Spring CVEs are fixed in 4.x and, for paying customers, in 3.5.x. An unpatched 3.5 app is an unpatched app | |
| Spring Boot 3.4 and older | Out of OSS support | Upgrade path is 3.5 → clear every deprecation → 4.x. Do not jump from 3.2/3.3 straight to 4 |
What Boot 4 / Framework 7 changed that breaks code AI writes from memory:
- Java baseline stays 17; Java 25 is the tested first-class target (AOT and native-image builds are validated on 25).
- Jakarta EE 11 — Servlet 6.1, JPA 3.2, Bean Validation 3.1. Needs Tomcat 11+ or Jetty 12.1+. `spring-boot-starter-undertow` was removed.
- Jackson 3 is the default. Group id moves from
com.fasterxml.jacksontotools.jackson;Jackson2ObjectMapperBuilderCustomizerbecomesJsonMapperBuilderCustomizer; Jackson 2 properties move underspring.jackson2. Any answer that reaches forcom.fasterxml.jackson.databind.ObjectMapperconfig on Boot 4 is targeting the wrong library. - Kotlin 2.2 baseline; the codebase is split into 70+ focused jars. Starters still pull the right set, but a hand-written dependency list from a Boot 3 project will miss modules.
The Spring Boot footguns AI walks into most
1. @Transactional self-invocation: the proxy bypass
Spring's @Transactional is implemented via a proxy (AOP). When a bean method calls another method on the same bean instance (this.someMethod()), the call goes directly to the target object, not through the proxy — the transaction advice is never applied.
2. Checked exceptions do NOT roll back @Transactional by default
Spring rolls back only on unchecked exceptions (RuntimeException and its subclasses) by default. A checked exception thrown inside a @Transactional method commits the transaction unless you say otherwise.
3. Propagation and isolation: pick deliberately, not by default
@Transactional defaults are PROPAGATION_REQUIRED (join existing tx or create one) and ISOLATION_DEFAULT (whatever the DB default is, usually READ COMMITTED). AI accepts both defaults everywhere — that is wrong for several common patterns:
| Scenario | Correct setting | Why the default is wrong | |
|---|---|---|---|
| Audit log that must persist even if the outer tx rolls back | PROPAGATION_REQUIRES_NEW | REQUIRED rolls the audit row back with the outer tx | |
| Read-only report query | @Transactional(readOnly = true) | Hibernate reduces flush and dirty-check work. It is a hint — it does not route to a read replica; that needs an explicit routing DataSource or a proxy | |
| Preventing lost-update on concurrent state machine | ISOLATION_REPEATABLE_READ or row-lock | READ COMMITTED allows a concurrent read of the row before the update commits | |
| Independent retry unit inside a larger operation | PROPAGATION_REQUIRES_NEW | REQUIRED merges into the outer tx; a rollback undoes everything |
4. JPA/Hibernate N+1: lazy associations in a loop
Hibernate defaults to lazy loading for @OneToMany and @ManyToMany. A loop that accesses a lazy collection issues one SELECT per entity — N+1 selects.
`LazyInitializationException` occurs when a lazy field is accessed after the Hibernate session has closed (outside the @Transactional boundary). If you serialize an entity in a Spring MVC controller that sits outside the service's transaction, Hibernate can't issue the lazy SELECT. Fix: load everything you need inside the service/transaction, or use a DTO projection.
5. open-in-view: still enabled by default in Boot 4
spring.jpa.open-in-view still defaults to `true` in Spring Boot 4 — the proposal to flip it (spring-boot issue #47547) is open, not merged. Boot logs a startup warning telling you to configure it explicitly; that warning is the only signal you get. The setting keeps the Hibernate session and a pooled DB connection open for the entire HTTP request including view rendering. Lazy loads then work in the controller layer — which masks N+1 instead of fixing it and holds connections far longer than needed.
This gets worse with virtual threads: spring.threads.virtual.enabled=true removes the thread-count ceiling that used to limit how many requests could hold a connection at once, so open-in-view turns straight into connection-pool exhaustion under load.
After disabling, LazyInitializationException surfaces in controllers that relied on it — good. Fix each case with eager fetch or DTO.
6. Singleton bean scope: never store per-request state
All Spring beans are @Scope("singleton") by default — one instance shared across all threads. Storing mutable state in a singleton service field is a data race with request bleed.
Use @RequestScope beans sparingly (they require a proxy wrapper to inject into singletons) and only when you have a genuine per-request lifecycle need.
7. @Async: which executor you actually get, and its unbounded queue
The common claim that "@Async with no configuration uses SimpleAsyncTaskExecutor and spawns an unbounded number of threads" is true for plain Spring Framework and wrong for Spring Boot. Boot auto-configures an applicationTaskExecutor bean (a ThreadPoolTaskExecutor, 8 core threads by default) and @EnableAsync picks it up. The real Boot failure modes are different:
- The queue absorbs everything, so `max-size` is never reached. A
ThreadPoolTaskExecutoronly creates threads beyond core size once the queue is full. Boot's defaults arecore-size=8,max-size=Integer.MAX_VALUE,queue-capacity=Integer.MAX_VALUE— an unbounded queue in front of 8 threads. The pool never grows, work piles up in heap, latency climbs, nothing scales out, and a restart drops every queued task. - One shared executor for everything.
applicationTaskExecutoralso backs Spring MVC async request handling, WebSocket, and other framework work. A slow@Asyncemail job starves unrelated framework tasks. - Virtual threads silently change the semantics. With
spring.threads.virtual.enabled=true, the auto-configured executor becomes aSimpleAsyncTaskExecutoron virtual threads and the scheduler becomesSimpleAsyncTaskScheduler— all pooling properties are ignored. Everyspring.task.execution.pool.*value you set is silently dropped, and there is no backpressure at all.
@Async is still not a queue. Anything that must survive a pod restart belongs in a real broker or an outbox table, not in an in-memory executor queue.
Exception swallowing: exceptions thrown inside @Async methods are not propagated to the caller. They are silently swallowed unless you implement AsyncUncaughtExceptionHandler or return a Future / CompletableFuture and handle it.
8. Input validation and overposting: @Valid + narrow DTOs
Never bind the request body directly to a JPA entity — the client can supply id, role, isAdmin, tenantId, or any other field Hibernate will happily write.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/mir-backend-jvm-spring/SKILL.md
Popularity
- Repository stars
- 15
- 7-day trend score
- 14
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/anantbhandarkar/make-it-right/mir-backend-jvm-spring)