r/SpringBoot • • 12h ago

Discussion Transactional Outbox is harder than you think

20 Upvotes

I had to write a transactional outbox for two of my projects. The popular solutions didn't fit, and CDC with Debezium felt too heavy for "save an event together with the data, send it later".

We all know things often look simpler on paper than in reality, right? What's there to do, really? Just write to a table, poll it, publish the messages - easy, right?

Not so fast. Building a production outbox is like growing a stalactite: it slowly accretes features, scripts and workarounds. So I want to share my hard-won solution, which I wrapped into a simple, fairly compact, ready-to-use starter that has (I hope) everything you need.

Guarantees (with caveats):
- At-least-once delivery with retries and backoff.
- Effectively-once processing through an inbox (deduplication on the consumer side).
- At-most-once processing through the inbox, for side effects like emails where a duplicate is worse than a miss.

Two design decisions I’m happy with:
- Adaptive polling. While an event type has nothing to send, the pause between polls grows up to a maximum, and drops back to the minimum as soon as events appear. This noticeably reduces DB load.
- Per-event-type settings. Each type has its own poll interval, batch size and retry count. Critical events go out within a fraction of a second, while reports can wait a few minutes when there’s no activity.

Repo: https://github.com/dmitriy-iliyov/oncebox

Feedback is very welcome. If you’ve built an outbox in Spring yourself, what was your biggest pain point?


r/SpringBoot • • 4h ago

Question Recommendations for Spring Cloud AWS

3 Upvotes

Hey everyone. I’m looking for some recs on learning spring cloud aws for work. I am a new backend dev for my team that heavily utilizes microservice apps written in Java and uses Spring as a framework. I’ve been working through the latest version of spring start here and it has been helpful to a degree. I understand the basic flow between building APIs that interact with some persistent data source and return results back to the client but I noticed a large chunk of our services interact with aws services such as S3, SNS, SQS and other stuff like opensearch. I do not know much on development with these services. I have used s3 before for a previous job and understand high level of sqs/sns but I don’t know how they interact with the apps we maintain. I try to review our code and see if I can make sense of it but I am having a hard time distinguishing our custom logic with Spring’s so I am looking for recommendations that would allow me to teach myself on them. For now , the services I mentioned : S3, sqs, sns and open search are top priority as those are the services that I know we interact with the most. I have not had much interaction with the apps that utilize those since I am still newer and haven’t had much on my plate but I want to be prepped enough to at least diagnose what is occurring in the code when it comes down to it. Thank you!


r/SpringBoot • • 5h ago

How-To/Tutorial JPA vs Hibernate vs JDBC: What Each One Actually Does | Visually Explained

Thumbnail
youtu.be
3 Upvotes

Hey everyone,

I made a video for anyone who uses Spring Data JPA but still isn't sure what JPA, Hibernate and JDBC each do, or how they differ.

It's visually explained. It follows one save() call from a Spring Boot app down to the database, so you can see what happens behind the hood and where Hibernate comes from. It's about 11 minutes.

Hope it helps someone, and tell me if anything is unclear . Thank you for the support as always


r/SpringBoot • • 4h ago

Question Spring AI's validateSchema() catches malformed output.

0 Upvotes

I've been working on LLM extraction in Spring Boot services (invoices, forms, that kind of structured data), and kept hitting the same issue.

Spring AI 2.0's `validateSchema()` is great: it checks the response against the record's JSON schema and retries with the error if it fails. But the bugs that actually hurt me passed that check:

- A line item silently dropped, so the rows no longer added up to the total

- A value that never appeared anywhere in the source document

- Correct output on Monday, slightly different output after a prompt tweak on Friday

The JSON was valid and deserialized cleanly into my record every time. The data was just wrong.

Using a second LLM as a judge in tests felt like the wrong fix: slower CI, token costs, and tests that don't give the same verdict twice.

So I started writing deterministic checks as plain JUnit tests instead:

- Cross-field arithmetic with BigDecimal (parts must sum to totals)

- Provenance: extracted values must actually appear in the source

- Latency and cost budgets per call

- A golden set of JSONL examples that runs on every PR, so a prompt or model change shows up as a failing build

I ended up packaging this as an open-source library, Outputgate (on Maven Central, works alongside Spring AI rather than replacing anything). One known limitation: provenance matching is currently verbatim, so `1,200.00` vs `1200` can fail correct output. Normalized matching is what I'm working on next.

Repo: https://github.com/ravismash/outputgate

But I'm mostly curious how others handle this:

  1. Do you test LLM output correctness in CI at all, or only at runtime?

  2. Are you using LLM-as-judge evaluators, hand-written checks, or something else?

  3. What's the worst "valid but wrong" output you've caught?


r/SpringBoot • • 6h ago

Question Is Spring needed in this situation ?

0 Upvotes

I m currently new to Spring and learning important concepts related to this but one thing stick in my mind imagine we have 1000 classes and just a hypothetical situation that all of them somehow is independent classes there is no dependency injection at all is there spring needed in this situation at all ?


r/SpringBoot • • 2d ago

Discussion Generate a Spring Boot project with security, users, roles and audit log already wired (free)

52 Upvotes

Most new Spring Boot business apps start with the same week of plumbing: security config, user and role management, persistence, an audit trail, email, i18n. We got tired of rewriting it, so we packaged those features as Spring Boot modules (AppJars) and built a generator around them.

With Craft you pick the modules, set group/artifact, Java 21 or 25, H2 or PostgreSQL, and download a Maven project that runs with mvn spring-boot:run. Each module brings its own entities, services, auto-configuration and UI views (built with Vaadin), so you’re not just getting a skeleton.

It’s free to use: every module has a Free Mode that also works in production within documented limits, so no license key is needed to try it.

https://craft.appjars.com

Disclosure: I’m part of the team behind it. Questions:

- If you’ve tried scaffolding a Spring Boot app with an AI assistant, where did it fall short? Security config, outdated APIs, something else?

- The ready-made UI is Vaadin today, but we’ve been working on an optional React layer and are evaluating whether to release it. Would that make this more useful to you?


r/SpringBoot • • 1d ago

How-To/Tutorial JWT Authentication with Spring Boot + React — Implementation Guide

2 Upvotes

I wanted to share a practical guide covering JWT authentication in a Spring Boot backend with a React frontend.

It covers access and refresh tokens, Spring Security integration, Axios interceptors, token expiration, and secure storage practices.

The goal is to explain how the authentication flow works across the backend and frontend, with implementation examples rather than just theory.

Full article: https://arjunthakur.dev/blog/jwt-spring-boot-react-guide.html

Would be interested to hear how others approach access-token storage and refresh-token handling in their applications.


r/SpringBoot • • 2d ago

How-To/Tutorial Spring Boot Logging: From Zero to Grafana Loki

Thumbnail
youtu.be
13 Upvotes

Spring Boot Logging: From Zero to Grafana Loki
https://youtu.be/SvvEc8gaeMI


r/SpringBoot • • 2d ago

Question Where can i learn Spring data JPA and Hibernate from scratch.

6 Upvotes

In the JavaScript/NodeJs world. I can just visit drizzle’s site of prisma and learn about everything but with springboot i am not seeing anything like that. More like references, i don’t even know. It makes me lose interest but i don’t want to give up. Still want to learn Spring boot and it’s core libraries


r/SpringBoot • • 3d ago

Question Railway Alternative

6 Upvotes

Can anyone suggest a good alternative to Railway for deploying a Spring Boot backend with an SQL database? I'm looking for something beginner-friendly with a free tier, if possible. Would appreciate any suggestions or recommendations. Thanks!


r/SpringBoot • • 4d ago

How-To/Tutorial Kotlin Debugger (Springboot) - Visual Studio

16 Upvotes

Most Spring Boot developers I know use Java, but Kotlin has always been an interesting alternative, especially with its concise syntax and null safety.

While experimenting with Kotlin/JVM projects in VS Code, I realized something.

Writing Kotlin was straightforward. Debugging it? Not so much.

I could always switch to IntelliJ, but I wanted to stay in VS Code, set a breakpoint, inspect what was happening, and move on.

That curiosity sent me down a rabbit hole of JVM bytecode, Kotlin inline functions, and source mapping.

Eventually, I ended up building Kotlin Debugger, an open-source VS Code extension that doesn't require a separate Kotlin Language Server.

It's still a work in progress, especially around coroutine debugging, but I'm exploring how to make Kotlin/JVM debugging more convenient for developers who prefer VS Code.

GitHub: https://marketplace.visualstudio.com/items?itemName=kparth01.kotlin-debugger

Curious how many Spring Boot developers here actually use Kotlin? And if you do, are you using IntelliJ or VS Code?


r/SpringBoot • • 5d ago

How-To/Tutorial Domain-Driven Design (DDD) — The Complete Guide | Visually Explained

Thumbnail
youtu.be
12 Upvotes

Hey everyone! I just put out a video on Domain-Driven Design. It’s a long one, about 20 minutes, but I really believe it’s worth your time. It took me a lot of time to make, so I hope it helps you, and I’d love to hear what you think! 🙌


r/SpringBoot • • 5d ago

How-To/Tutorial Can a real Java app fit in a 50MB Docker image?

Thumbnail
youtu.be
4 Upvotes

r/SpringBoot • • 5d ago

News New version of JetBrains plugin to keep API in sync

Post image
2 Upvotes

v5.0.0 introduces new features to empower your AI agents and close gaps between API definitions and implementations

🤖 For agents:
This release brings bundled MCP tools designed to simplify day-to-day work with Spring Messaging as well as with AsyncAPI documents

Just enable bundled MCP server, register AsyncAPI skill trough Tools -> Install AsyncAPI Agent Skilland, and you are redy to go

⚙️ For architects, engineers, analysts, and API authors:
New Diff feature helps you see which gaps exist between your sources:
- Document against a Apache Kafka broker or cluster
- One Apache Kafka or cluster against another
- Source code against a Apache Kafka broker or cluster (Spring projects only)
- Document against a source code (Spring projects only)

💡 Works across IDEs editions, Community included

Together with not-yet announced Kurkik project, this features lay foundation for self-maintaining API approach

Sound interesting? Open your JetBrains IDE, grab the update and give it a spin: https://plugins.jetbrains.com/plugin/15673-asyncapi/versions/stable/1195232


r/SpringBoot • • 5d ago

How-To/Tutorial I got tired of Claude Code "forgetting" my Spring Boot architecture, so I made hooks refuse the bad writes instead

0 Upvotes

Context: I use Claude Code for Java at work. It starts great. A 30-line CLAUDE.md, clean hexagonal layout, everything respects the boundaries.

Then six months in the CLAUDE.md is 400 lines, the model ignores half of it, and a controller is importing a JPA entity because "it was faster".

At some point I stopped trying to write better prompts. A rule that must always hold shouldn't be a paragraph the model has to remember. It should be something that fails the write.

So I built Nerviz. It's a harness for Spring Boot on Claude Code, and it does three things:

  1. Generates the project from an architecture declared as YAML. Nine blueprints right now (hexagonal, clean, onion, layered, vertical slice, modular monolith, plus single-module variants). Versions come from Spring Initializr at run time, never from the model's memory. I got burned by that more than once.

  2. Designs each feature as a spec before any code exists. /new-feature asks only the questions that change the design (who can call it, duplicates, retention...), and one skill per layer writes its part. You approve it, it gets frozen and committed, and only then does /new-feature-implement write code, in a clean session.

  3. Blocks at write time. A forbidden import, a write outside a skill's territory, an edit to an approved spec, a force push: a hook refuses it. The model isn't asked to behave.

The part I care about most: the generated project carries the whole harness with it, plus its own CI. Whoever clones it doesn't need Nerviz installed.

To keep this from being vaporware, I generated a demo project end to end. It's a bank-app with a green mvn clean verify, and the run took about 20 minutes. The numbers come from the session transcripts, not from me guessing. The approved spec, the partials and the audit report from that run are all public in the repo.

Things it is not: it's not a coding assistant (no model, no editor), not a project template, and not an agent framework. It constrains one agent, it doesn't build agents.

It's MIT and it's early, so there are rough edges. I can't cover every architecture or every way a team uses Spring Boot on my own, and that's why I'm posting. I want contributions. A blueprint for the architecture your team actually uses is a YAML file and changes no prompt, so it's a good first PR. Bug reports, a new rule that should be enforced by a hook, new skill/agent, a doc fix, and "this broke on my machine" issues all help just as much.

I'd also like to know which of the architectures you'd actually use, and which rule you'd want enforced first. I have my own list, but I suspect yours is different.

Repo (issues and PRs welcome): https://github.com/nerviz-ai/nerviz

Site: https://nerviz.dev


r/SpringBoot • • 6d ago

How-To/Tutorial The UI Framework for Java & Spring

Thumbnail
youtube.com
10 Upvotes

Most web frameworks are built for the public internet: for reach and experiences for strangers. Vaadin is built for the other side of the login. For the data-defined, functionally beautiful and long-lived apps your organization actually runs on.


r/SpringBoot • • 6d ago

Question How to segregate read and write queries in Spring boot microservices env.

13 Upvotes

Im an intern and was assigned a task to segregate the read , read-write queries / methods . The read is supposed to go to port 66 and write on port 67 in the database.

Currently ive defined two db url in yml and have routed every method having read-only using transaction(read-only).

Is this the way to do it or is there any other efficient way.


r/SpringBoot • • 6d ago

Question How do you monitor, schedule and restart Spring Batch jobs in production?

9 Upvotes

I work with Spring Batch and keep running into the same gap, so I’m trying to learn how other teams deal with it.

Spring Batch is great at the processing itself (chunks, skip/retry, restart). But around it I’ve found almost nothing built in:

  • a UI to see job and step status without querying the BATCH_* tables
  • scheduling and job-to-job dependencies (run A, then B and C, then D)
  • alerts when a job fails, gets stuck in STARTED, or runs much longer than usual
  • execution logs tied to a specific job run
  • a safe way to launch, stop, or restart a failed job from a screen

From what I can tell, Spring Batch Admin is retired and Spring Cloud Data Flow is no longer maintained as open source, so I’m not sure what teams use now.

For those running Spring Batch in production:

  1. How do you schedule and chain jobs (cron, Quartz, Jenkins, Airflow, Control-M, something custom)?
  2. How do you find out a job failed or hung, and how do you see what happened?
  3. How do you restart failed jobs, and who does it?
  4. What’s the most painful part of your current setup?

I’m not selling anything. I’m researching whether it’s worth building an open-source tool for this, and I’d rather hear real experiences before writing any code. Even a short answer helps, and I’m happy to share a summary of what I learn.


r/SpringBoot • • 7d ago

Question Best Springboot tutorial series

17 Upvotes

Hello, i want to learn Java Spring Boot. Can anyone suggets me the best resource for learning java springboot from beginning to advance level that can led me to internship or industry level coding?

I was looking for video tutorial series that has everything for a becoming a java developer include devops work as well.and best for learning as beginner and proceed to advanced topic.


r/SpringBoot • • 7d ago

News 🚀 Embed-JNoSQL v1.0.2 is officially released

Thumbnail
2 Upvotes

r/SpringBoot • • 7d ago

Question How is the spring security course by Eazy bytes on Udemy

Thumbnail
1 Upvotes

r/SpringBoot • • 8d ago

How-To/Tutorial 10 Ways to Make a Spring Boot App Faster (Every One Measured)

Thumbnail
youtu.be
13 Upvotes

r/SpringBoot • • 8d ago

Discussion Spring Boot + HikariCP: 20 vs 2 idle PostgreSQL connections

7 Upvotes

I've been experimenting with HikariCP connection pool sizing in Spring Boot, particularly what happens to PostgreSQL connections after traffic stops.

One detail that's easy to miss: with Hikari's default sizing, minimumIdle and maximumPoolSize both resolve to 10. Since the idle target equals the maximum, idleTimeout has nothing to retire.

I ran two Spring Boot instances against PostgreSQL 16 on a 1 GiB VM, comparing three configurations:

  • Default sizing: Both pools retained 10 connections each after traffic stopped.
  • minimumIdle=1, retirement disabled: Pools still retained all 20 connections after growing under load.
  • minimumIdle=1, retirement enabled: Connections dropped from 20 to 2, with approximately 29 MiB lower PostgreSQL cgroup memory.

There was a tradeoff. When traffic returned, median connection acquisition increased from under 3 ms to roughly 200 ms as the pools rebuilt capacity.

The experiment used a deliberately short 10-second idle timeout to make the behavior measurable, not as a production tuning recommendation.

Two repetitions, 2,280 successful workload requests, with recorded data and reproduction instructions.

Full write-up: https://pvrlabs.xyz/articles/spring-boot-jdbc-pool-reclaim.html

Curious how others configure HikariCP when multiple Spring Boot instances share a small PostgreSQL server. Do you generally keep the default fixed-size pools or allow idle connections to retire?


r/SpringBoot • • 8d ago

Discussion The Midnight Technician; Spring Boot Microservice (Open-Source)

Thumbnail
medium.com
7 Upvotes

This is something I threw together over a year ago. It was designed to be an easy intro into Microservices since I had noticed lacking in the Spring Boot ecosystem that was something hands-on.

I am remaking it in a monolithic repo as a Spring Modulith project, since I noticed there is also a lack in that area for hands-on learning.

Just looking to share this little project with others who may be curious with no clear picture of where to start with them.

Cheers,

The Midnight Coder


r/SpringBoot • • 8d ago

Question Spring AI course

8 Upvotes

Please could u suggest a course of spring ai for beginners ( I experienced full stack apps from scratch with spring)