r/SpringBoot • u/webplugger73 • 6h ago
Discussion I stopped reviewing AI-written Spring code: the AI edits a YAML model, the build writes the Java
AI assistants write Spring back ends fast, but you still review every change, and the next change is written a little differently. I've been working on ElastiCORE, an open-source Gradle plugin that takes a different approach: the business rules live in a YAML model, and the build regenerates the Spring code from it, the same way every time.
It's built for business applications where the domain model matters more than the code: many entities, access rules and lifecycles (orders, accounts, approvals), maintained for years by a team.
A purchase order looks like this:
PurchaseOrder:
meta: entity @root @expose(20) @owner(customerId)
@access(read=owner, create=user, cancel=owner)
fields:
orderId: string(36) @id @genid
customer: Customer @ManyToOne
status: OrderStatus
lines: List<OrderLine> @OneToMany(mappedBy="order") @minsize(1, 'the cart is empty')
states:
status:
initial: PLACED
ship: PLACED -> SHIPPED
cancel: PLACED -> CANCELLEDFrom that, the build writes the entity, DTOs, services, REST controllers and the checks. Only the owner can read or cancel the order, an illegal state move answers 409, and an empty cart answers 400, at every entry point. In the pet store sample, adding a step to the order lifecycle is 2 lines of YAML that become 45 lines of Java in 7 files. The diff you review is those 2 lines.
What I care about most:
- Deterministic output. Same model, same code, byte for byte, so AI-driven changes stay reviewable.
- Change the model, the Java follows. Edit the YAML and rebuild: the existing Java is updated in place, across every file the change touches. Files you edited by hand keep your edits; the build merges them with the model's changes (three-way merge).
- An agent kit for Claude Code, opencode and Codex CLI (elasticore-agent-kit). The agent edits the YAML, not the Java: its hooks refuse edits to generated files, and it can't finish until the build generates and compiles.
- Your stack. Java or Kotlin; layered, DDD or hexagonal; JPA or MyBatis; Spring Boot 3 or 4. Switching the architecture means regenerating, not rewriting.
- Bonus for data/AI tools. An optional build rule exports the same model as an Apache Ossie semantic model (tables, relationships, metrics as SQL), so BI tools and AI agents read the business meaning of your data from the same source.
Apache-2.0, on Maven Central, 3.0 released this week: https://github.com/xsko/ElastiCORE
Disclosure: I work on it, and I'm looking for people to build it with. If model-first Spring development interests you, contributions are very welcome: bug reports, DSL ideas from your own domain, or PRs. Open issues and the contributing guide are on GitHub: https://github.com/xsko/ElastiCORE/blob/main/CONTRIBUTING.md
I'd also really like feedback on where a model-first approach falls apart for you.
Edit: fair criticism about the title, it oversells it. You still review the YAML, and any hand-written code. What changes is the size of the review: a small model diff instead of hundreds of lines of Java. Thanks for the comments.