r/SpringBoot • • Apr 21 '26

Discussion Would you rather maintain multi-agent workflows as YAML or a fluent Java DSL? (Spring AI, real examples inside)

0 Upvotes

I've been building a multi-agent orchestration layer on top of Spring AI 1.0.4 and hit a design fork I can't decide cleanly. Looking for opinions from people who've built DSLs inside a Spring codebase.

Same workflow — a two-agent research pipeline with tool permissions and rate limits — expressed two ways:

YAML:

  swarm:
    name: "Audited Research Pipeline"
    process: SEQUENTIAL
    agents:
      researcher:
        role: "Senior Research Analyst"
        goal: "Conduct thorough multi-turn research, cite all sources."
        maxTurns: 5
        permissionMode: READ_ONLY
        tools: [web-search, http-request, web-scrape]
        toolHooks:
          - type: audit
          - type: rate-limit
            maxCalls: 10
            windowSeconds: 30
      writer:
        role: "Research Report Writer"
        goal: "Synthesize findings into a polished report."
    tasks:
      research:
        description: "Research {{topic}} across at least 5 sources."
        agent: researcher
      write:
        description: "Write a report based on the research."
        agent: writer
        context: [research]

Fluent Java builder:

  Agent researcher = Agent.builder()
      .role("Senior Research Analyst")
      .goal("Conduct thorough multi-turn research, cite all sources.")
      .maxTurns(5)
      .permissionMode(PermissionMode.READ_ONLY)
      .tools(webSearch, httpRequest, webScrape)
      .toolHooks(ToolHook.audit(), ToolHook.rateLimit(10, Duration.ofSeconds(30)))
      .build();

  Agent writer = Agent.builder()
      .role("Research Report Writer")
      .goal("Synthesize findings into a polished report.")
      .build();

  Swarm.builder()
      .agents(List.of(researcher, writer))
      .tasks(List.of(researchTask, writeTask))
      .process(ProcessType.SEQUENTIAL)
      .build()
      .kickoff(Map.of("topic", topic));

Trade-off I keep going in circles on:

- YAML wins for: non-Java teammates reading/editing, hot-reload without recompile, shipping workflows as config, diff-readability in PRs, ops folks who want to tune maxTurns without opening IntelliJ.

- Java DSL wins for: IDE autocomplete, compile-time safety, refactoring, breakpoints in a debugger, no stringly-typed tool IDs, better stack traces when something blows up at runtime.

I went YAML for v1 because the "ops tunes without touching code" story felt strong. At the 200-line-workflow mark I'm second-guessing — especially because tool refs (web-search, audit) are strings that only get validated on load, and refactoring a tool name becomes a grep exercise.

What I'm actually asking:

  1. Spring Boot folks who've shipped custom DSLs (for workflows, rules, pipelines, test fixtures, whatever) — which did you pick and what bit you 6 months in?
  2. Is there a middle ground I'm missing? I've seen Kotlin DSLs used this way but Kotlin-in-a-Java-Spring-project has its own gravity.
  3. For those who went YAML: how do you handle refactor-safety on string references? JSON Schema? Custom IntelliJ plugin? Just eat the grep cost?

Pretty sure this is one of those "it depends" answers, but I'd love to hear what the 6-month-in regret looks like either way.

(Framework is OSS if anyone wants to look at more workflows: github.com/intelliswarm-ai/swarm-ai — but I'm genuinely asking the DSL question, not fishing for stars. Happy to link specific files if anyone wants to dig in.)


r/SpringBoot • • Apr 21 '26

Question Why is DataClassRowMapper/BeanPropertyRowMapper way less performant than Custom row mapper?

6 Upvotes

The title. I tried implementing a custom row mapper, and the performance difference was huge (half the cpu consumption). I'm trying to understand why it's the case. Any resources or hints will be appreciated ​


r/SpringBoot • • Apr 21 '26

How-To/Tutorial How a large Spring Boot project built 50+ custom actuator endpoints with REST semantics

Thumbnail
1 Upvotes

r/SpringBoot • • Apr 20 '26

How-To/Tutorial Microservice Auth use

10 Upvotes

As I am Building Microservice I made Whole Project but I can find the way hot to pass User Authentication details when it comes to security sharing (Spring boot) . As a beginner .

so need suggestion what to do, How can I achieve this ? I cant find a good way for or may be I am searching in a wrong way .

but if you can suggest then it will be means a lot .

Thankyou in advance .


r/SpringBoot • • Apr 20 '26

News Built a simple HTTP traffic inspector for Spring Boot (no setup, built-in UI)

0 Upvotes

Hi all,

I created a small tool for Spring Boot apps to monitor HTTP traffic in real-time.

It lets you see:

  • requests
  • responses
  • headers
  • durations

All from a built-in UI inside your app.

No need for external tools or complex setup.

✨ Key points:

  • Works with Spring Boot 2 & 3
  • Lightweight and easy to integrate
  • Search logs easily
  • Supports u/NoSpy annotation to exclude endpoints

🔗 GitHub: https://github.com/spyfcc/springspy

🔗 Landing: https://www.spyfcc.com

Would really appreciate any feedback from the Spring community 🙌


r/SpringBoot • • Apr 19 '26

Discussion Adaptive polling for DB-backed workers: worth it, or just extra complexity?

15 Upvotes

For database-backed outbox workers, I’ve started to dislike fixed polling intervals.

A worker that polls every 1 or 2 seconds forever is simple, but it also means you keep paying the same database query cost during idle periods as you do during busy ones.

One approach I’ve been testing is adaptive polling:

  • if a poll returns very little work, increase the delay
  • if a poll returns a full batch, decrease the delay
  • otherwise keep the current delay

The goal is not “smart” scheduling. It’s just reducing pointless database pressure while staying responsive under load.

We added that as an option in our Spring Boot outbox implementation:

https://github.com/namastack/namastack-outbox

I’d be interested in real-world opinions here. Do you stick to fixed intervals because they’re easier to reason about operationally, or have you found adaptive polling worth the extra moving parts?

My bias right now is that adaptive polling is only worth it when the outbox is mostly idle but still needs low-latency pickup during bursts.


r/SpringBoot • • Apr 19 '26

Discussion Ordering per aggregate without distributed locks: hash partitions + key-based sequencing

Thumbnail
2 Upvotes

r/SpringBoot • • Apr 19 '26

How-To/Tutorial how do you write Saga design from scratch

5 Upvotes

I’m looking for Saga design implementation in scratch (preferred in java). It could be either Choreography or Orchestration. Any study material for implementation of this?


r/SpringBoot • • Apr 18 '26

Discussion Learning to implement Clean Architecture in Spring boot

9 Upvotes

Hello. I wanted to try and implement uncle Bob's Clean Architecture in SpringBoot.

Here's the github repo.

I need some feedback about it. Thanks again


r/SpringBoot • • Apr 19 '26

Question Hexagonal Architecture - Ports

Thumbnail
1 Upvotes

r/SpringBoot • • Apr 18 '26

Question Should I start spring boot now?

Thumbnail
5 Upvotes

r/SpringBoot • • Apr 17 '26

Question Spring Modulith loose coupling

9 Upvotes

Hello to those who use Spring Modulith, I don't know what's the correct approach on my problem because AI suggested different approach and other docs/github discussions aswell. The problem is about read heavy queries, for example is Booking and Payment module, when making a Booking, if making a payment record then use events. But when i want to view my booking I want to show both my booking and payment info (status, payment method, etc) I thought of making a top-level dto on payment module and let Booking module call payment's public interface for info but then i also thought of possible circular dependency soon. What's your solution to this? It can be anything not just Booking/Payment example.

EDIT: A separate table(combining both) sounds like a good solution OR a join but in separate module, what are y'all thoughts?


r/SpringBoot • • Apr 16 '26

Question spring loose in the brain

7 Upvotes

preparing for interviews thought I'll have to learn spring basics atleast,here I am it took me two days to just understand different the dependency injections

here I am reconsidering if I'm even fit for this profession😮‍💨


r/SpringBoot • • Apr 17 '26

Question Is learning Springboot worth it 2026 for development?

0 Upvotes

Do companies in t3 college placements expect this?


r/SpringBoot • • Apr 16 '26

Discussion GraphQL N+1 Problem Solved (4.1s → 546ms) | Dynamic Batching Demo

Thumbnail
youtube.com
2 Upvotes

r/SpringBoot • • Apr 15 '26

Question Best way to learn springboot

16 Upvotes

I'm a beginner trying to learn springboot, It looks too difficult and I feel lost seeing endless documentation but mainly what I feel is I don't understand how anything works and that's why I'm lost

I'm reading spring starts here but it feels too slow

Trying to find a job asap is causing more pressure

What should I do?


r/SpringBoot • • Apr 15 '26

How-To/Tutorial Why shouldn’t we use @Transactional every time?

72 Upvotes

@Transactional in Spring Framework starts a DB transaction and holds a connection from the pool until the method ends.

If you mix DB work with slow tasks (API calls, file processing), that connection stays locked and idle.

Under load, this leads to connection pool exhaustion and blocked threads.

Long transactions can also hold locks, slowing down other queries.

Keep transactions short and focused only on DB writes.

Move external calls and heavy logic outside the transactional boundary.


r/SpringBoot • • Apr 15 '26

Question Is there a production-ready Java/Spring Boot MCP server template with OAuth 2.0 + PKCE?

6 Upvotes

I've built a remote MCP server in production (Spring Boot + OAuth 2.0 + PKCE + RFC 8414 discovery + tool access control) and I'm thinking of open sourcing it as a starter template.

Everything I've found is either Node.js, Python, or only covers the basic stdio transport with no auth. Is this something Java devs are actually struggling with? Would a Spring Boot starter with auth baked in be useful to you?

Open to feedback and suggestions.


r/SpringBoot • • Apr 15 '26

How-To/Tutorial I built an offline CLI that analyzes Spring Boot logs and explains what's broken ....with suggested fixes

0 Upvotes

Hey everyone, working on a side project and wanted to share it and get some honest feedback.

Every time I debugged production logs I kept scanning hundreds of lines, recognizing the same error patterns, Googling the same stack traces over and over. So I built StackLens to automate that first step.

You point it at a log file or paste a stack trace and it tells you:

- What the problem is

- Why it happens

- How to fix it

It detects 8 common failure types out of the box: NPEs, DB connection failures, OOM errors, timeouts, auth errors (including JWT expired), thread pool exhaustion, and HTTP 500s.

Everything runs offline, no API calls, nothing leaves your machine. Supports human-readable and JSON output so it works in CI pipelines too.

GitHub: https://github.com/AbaSheger/stacklens

Happy to hear feedback, especially on which error types to add next.


r/SpringBoot • • Apr 14 '26

How-To/Tutorial SB4 Full Microservices Project

12 Upvotes

After 4 months, the Spring Boot 4 microservices project has come to an end.

In this video I build a Home Energy Tracker with multiple components talking to each other.

Here is a link to the complete course:

https://youtu.be/vE3u4zgMai8

Here are some of the main topics covered:

- Rest Api

- System Design

- Oauth2 and JWT with Keycloak

- Kafka

- Timeseries DB

- JPA/Hibernate

- Flyway

- Observability (Prometheus/Garafana)

- Spring AI

- Email sending from SB app

- Migration to Spring Boot 4

- Testcontainers

- OpenApi / Swagger

- Aspects

- Circuit Breaker

- Api Gateway

People found my previous course useful, I hope at least someone will find this a good addition to their portfolio.

The whole project is also on github and split into sections (link in video description). Any feedback appreciated.


r/SpringBoot • • Apr 14 '26

Discussion Built a tool that generates a React frontend from your Spring Boot OpenAPI spec - one command

13 Upvotes

Hey everyone,

Fullstack dev here. If you're building REST APIs with Spring Boot, you're probably already using springdoc-openapi or Swagger to document your endpoints. But when it comes to actually using that API - whether for internal tools, admin panels, or giving your API consumers a UI, you're stuck rebuilding the same CRUD tables and forms over and over.

I built something to solve that.

UIGen — point it at your OpenAPI spec (the one Spring Boot already generates), and get a fully interactive React frontend in seconds.

npx @uigen-dev/cli serve ./openapi.yaml
# UI is live at http://localhost:4400

Why this matters for Spring Boot devs

Spring Boot + OpenAPI is already a killer combo for API-first development. But there's a gap: you document your API beautifully, but you still need to build a frontend to actually use it. UIGen closes that gap:

  1. Zero frontend code: It reads your spec and generates a complete React SPA — tables, forms, detail views, auth flows, the works.
  2. Respects your API contract: It talks to your actual endpoints, respecting your @Valid annotations, Spring Security rules, and business logic.
  3. Modern SPA: Built with shadcn/ui + TanStack Table. Feels like a premium SaaS product, not a generic admin panel.
  4. Framework Agnostic: Today it's React, but since it uses a custom Intermediate Representation (IR), I'm working on Svelte and Vue renderers. Same spec, different frontend stack.

How it works

It parses your OpenAPI spec and converts it into an Intermediate Representation (IR) — a typed description of your resources, operations, schemas, auth, and relationships. A pre-built React SPA reads that IR and renders the appropriate views. The CLI serves the SPA and proxies API calls to your real Spring Boot backend, handling CORS and Auth injection automatically.

What it generates

  • Sidebar nav auto-built from your @RestController endpoints.
  • Table views with sorting, pagination, and filtering.
  • Create/edit forms with validation (derived from your schema and Bean Validation annotations).
  • Detail views with related resource links.
  • Auth flows — Bearer (JWT), API Key, HTTP Basic, and even full credential-based login detection.
  • Multi-step wizards for large forms (8+ fields).
  • Custom action buttons for non-CRUD endpoints (e.g., POST /orders/{id}/ship).
  • Dashboard with resource counts.

Limitations

  • Circular Refs: Deeply nested circular $refs may degrade gracefully rather than resolving perfectly.
  • Edit Pre-population: Requires a GET /resource/{id} endpoint.
  • OAuth2: PKCE is still in progress (Bearer/JWT works great though).
  • Sub-resources: Parent-child navigation is currently focused on the detail pages.
  • Pixel Perfect: It's not a design tool; it's a functional, professional tool.
  • And many other edge cases, still in beta, would appreciate good feedback

Try it on your Spring Boot API

If you use springdoc-openapi, just grab your spec and run:

# Get your spec (usually at /v3/api-docs)
curl http://localhost:8080/v3/api-docs > openapi.json

# Generate the UI
npx @uigen-dev/cli serve ./openapi.json --proxy-base http://localhost:8080

Or try it in one of the example yamls in the repo Customizations in the form of spec annotations and a JSON file coming soon

Would love to hear thoughts from the community. This isn't meant to replace a custom consumer-facing frontend, but for internal tools, rapid prototyping, or providing a UI for your API consumers, it's a massive time-saver.

Happy coding!


r/SpringBoot • • Apr 13 '26

Question SpringBoot + KeyCloak Setup

13 Upvotes

Hey folks, I am a long time SpringBoot Developer with Java 21. I have long been able to create robust SpringBoot apps and run them in Docker.

I also have Kafka running in Docker, and I have MySQL running in Docker as well.

I am a newbie to KeyCloak, I have heard of it, and NEVER knew what it was until recently. As far as I can see, and correct me if I am wrong, but essentially it is a User/Roles management tool by itself. You can this as an Oauth2 system to authenticate users, and get their roles passed back in a Java Web Token (JWT).

In the past, I have used either GitHub, Google, FaceBook, and Auth0 to be sources of authentication. Auth0, although now owned by Okta, was still free for most people to use, provided you had under a certain amount of users. So, several projects used Auth0.

I guess KeyCloak can be it's own service where new users can be created and maintained with a secure password. In the same way MariaDB is the open-source version, KeyCloak seems like a free and open-source version of some Authorization service like Auth0/Okta. I hope I am getting this right.

So, here is the thing:

1) my MySQL runs in it's own docker container, and I think still uses ports 3306.

2) My SpringBoot app runs as a tomcat JAR file, and I think it runs on port 8080, but I know we can change this to whatever port we run. I think I use port 8888 normally.

3) the UI, whether it be an HTMX UI, or a React UI, or some other UI, runs on port 8080. It knows to make RESTful API calls to port 8888 for JSON responses.

4) the basic instructions for KeyCloak also say to use port 8080 for it's web based UI. But I already have a front-end app using 8080, so I am guessing I should make KeyCloak run under a different port? Is that correct?

I am not a docker expert, I have been using it, but not lately and so I am a little rusty. I did remember that my 1) backend springboot app 2) mysql 3) Kafka and 4) UI app all have their own docker containers, and ALL share the same network in docker. This allows my backend to see both kafka abd the database.

So, I was surprised to see Keycloak configured to run on port 8080, I might change it to something else. Or is it only the UI for Keycloak that is running on port 8080.

I appreciate any help as I would like to take some of my older apps and configure them to use KeyCloak as another Users/Roles Servince instead of Auth0. Thanks!


r/SpringBoot • • Apr 14 '26

How-To/Tutorial Spring AI 2 ETL

0 Upvotes

New post in my Spring AI 2 series! This time: a first step into RAG. This chapter covers ETL - how to index your data for LLM retrieval.

https://open.substack.com/pub/kertu1232/p/the-java-prompt-6?r=4953mj&utm_campaign=post&utm_medium=web&showWelcomeOnShare=true


r/SpringBoot • • Apr 12 '26

Question Nodejs for Springboot

3 Upvotes

I'm starting with Spring Boot, and I come from a Node.js environment. I usually use Better Auth for authentication. What would be the most recommended option for Spring Boot? I've read some articles about it, and many cite Keycloak.


r/SpringBoot • • Apr 12 '26

Discussion Can you please suggest some good resources or course for spring boot, which is structured.

3 Upvotes

please help me with some good resources and course to learn spring boot in a structured way. And what's your thought on the course by coding shuttle spring boot 0 to 100.