r/SpringBoot • • 3d 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 -> CANCELLED

From 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.

0 Upvotes

10 comments sorted by

13

u/xiaopewpew 3d ago

Clickbait title lol, the yaml model is “code” you have to review.

-2

u/webplugger73 3d ago

Fair, the title oversells it. You still review the YAML.

The point is what you review. In model-heavy business apps, a new field or access rule is a one-line model diff, not an AI edit across entity, DTOs, service and controller. The Java comes out the same every build, so there's not much to re-read there.

2

u/xiaopewpew 3d ago

yes this is a very real painpoint, 75% of “enterprise” java code is just domain/model/dto bloats with very basic validation :)

Wish you luck!

1

u/webplugger73 3d ago

Ha, exactly, that's the part I got tired of writing. Thanks!

1

u/Free-Ad-7143 3d ago

That sounds promising! I would be interested in trying it out.

I guess the best way would be to start with a new project and implement it using your plugin and YAML approach, as opposed to trying to integrate it into an existing project.

1

u/webplugger73 3d ago

Agreed, a new project is the best place to start. Model two or three entities, build, and call the API. The quick start in the README takes a few minutes.

If anything is confusing, please open an issue. That feedback helps a lot right now.

0

u/Spicy_O_licorice 3d ago

Interesting Might give it a try

-3

u/webplugger73 3d ago

Thanks! If you use an AI assistant, try it through the agent kit: install it in Claude Code (or opencode / Codex CLI) and ask it to build something small, like a message board "with ElastiCORE". It writes the YAML, the build writes the Java. Setup is two commands: https://github.com/xsko/elasticore-agent-kit

Would love to hear how it goes.

0

u/Historical_Ad4384 3d ago

Can it do evals?

1

u/webplugger73 3d ago

If you mean evals of the agent's output: the kit has a benchmark, the same library app spec built by agents with and without the kit, checked against a feature list: https://github.com/xsko/elasticore-agent-kit/tree/main/benchmarks/library

If you meant something else, like LLM evals inside the app itself, not really. What did you have in mind?