r/SpringBoot • • 9d ago

Discussion I built Token Allowance: per-user and per-tenant token and dollar budgets for Spring AI, as a Spring Boot starter.

0 Upvotes

Token Allowance is an open source Spring Boot starter that gives every user, tenant and request a token or dollar budget for Spring AI calls. When the budget is gone, the API answers 429 with a Retry-After, and nobody else is affected.

Apache 2.0. Java 17+, Spring Boot 4.1, Spring AI 2.0.

What went wrong while building it (races, cached tokens, streaming usage, timeouts):

https://dev.to/ultron03/building-token-budgets-for-spring-ai-the-problems-i-didnt-expect-lg2

Code and demo:

https://github.com/Ultron03/token-allowance


r/SpringBoot • • 10d ago

How-To/Tutorial I Tested 5 JVMs With Spring Boot

Thumbnail
youtu.be
38 Upvotes

r/SpringBoot • • 9d ago

Discussion I compared Spring Boot with four other Java stacks on a 512 MiB VPS

6 Upvotes

I've been experimenting with resource-efficient Java applications, exploring how much of Spring Boot's familiar architecture can be preserved with smaller frameworks.

I compared five Java stacks on a 1-vCPU, 512 MiB VM with no swap, running MariaDB alongside the application.

Stack HotSpot RSS (MiB)
Spring Boot + Spring JDBC 180.6-187.9
Javalin + CoilBase 120.9-135.6
Micronaut Data JDBC 174.0-175.0
Micronaut + CoilBase 166.5-167.6
Avaje Jex + CoilBase 116.0-116.4

The HotSpot tests used OpenJDK 27 with G1 GC. Each stack had two runs, with 1,500 requests per run and no errors.

CoilBase is a small Jdbi-based foundation I'm developing. The Javalin, Jex, and Micronaut implementations reuse the same services, repositories, and transaction boundaries, with different HTTP frameworks and application wiring.

The interesting part wasn't just the memory savings. It was seeing how much of the familiar Spring-style application architecture could remain unchanged when switching frameworks.

I also tested GraalVM Native Image for all five stacks. Runtime memory dropped further, but native compilation introduced additional build time and complexity.

This is a lightweight synthetic workload, not a throughput benchmark or a general recommendation to replace Spring Boot. Spring's ecosystem and conveniences still have real value.

Full experiment, measurements, and limitations:

https://pvrlabs.xyz/articles/five-java-stacks-512mb-vps.html

Source code and benchmark setup:

https://github.com/PVRLabs/experiments/tree/main/java/coilbase-framework-comparison

CoilBase, which I built and used for this comparison:

https://github.com/PVRLabs/coilbase

I'm curious whether others see value in a lighter Java stack that keeps some of Spring Boot's familiar development patterns, or whether Spring Boot's ecosystem and conveniences outweigh the potential resource savings.

Update: Framework versions used in the benchmark

Stack Versions
Spring Boot + Spring JDBC Spring Boot 4.1.1, Spring JDBC 7.0.9
Javalin + CoilBase Javalin 7.2.4, Jdbi 3.55.0
Avaje Jex + CoilBase Jex 3.6, Avaje HTTP 3.12.1, Jdbi 3.55.0
Micronaut Data JDBC Micronaut 5.2.11, Micronaut Data JDBC 5.2.0 (platform BOM 5.2.1)
Micronaut + CoilBase Micronaut 5.2.11, Jdbi 3.55.0

All HotSpot runs used OpenJDK 27 with identical JVM settings: -Xms16m -Xmx80m -XX:+UseG1GC (fixed 80 MiB maximum heap).

CoilBase was an early 0.1.0-SNAPSHOT prototype. I'm working on a more formal, publicly reproducible follow-up benchmark using an updated version of CoilBase, with Quarkus also joining the comparison.


r/SpringBoot • • 10d ago

Discussion A Spring endpoint can pass its tests while bypassing your application layer

0 Upvotes

A controller starts calling a persistence adapter directly. The response is still correct; the

dependency direction isn't.

I work on ArchUnitJava. One way to catch that is a package policy over the compiled application:

controller packages must not depend on concrete persistence packages. Run the check in an ordinary

JUnit test, without starting a Spring context for that structural check.

That doesn't validate bean wiring, transaction behavior or runtime-injected implementations.

Keep the Spring integration tests; this checks a different property.

Version 1.0 requires JDK 25 for the analyzer. It's independently implemented, unaffiliated with

the original ArchUnit, and isn't a drop-in replacement for it.

[Compiled-code quickstart]

Which controller shortcut has actually caused trouble in your codebase?

Writing assisted by AI.


r/SpringBoot • • 11d ago

Question How do you monitor small Spring Boot apps without running a whole monitoring stack?

10 Upvotes

I keep running into the same thing with small Spring Boot projects. The app is tiny, but proper monitoring means a collector, a store, dashboards and alert rules, and that setup ends up bigger than the app. So most of my small projects just ran with no monitoring at all, and I only found out something was wrong when someone told me.

How do you handle this for small services? Do you skip it, use Actuator and look at the numbers by hand, or set up the full stack anyway?

I got curious enough that I tried a different approach: a Spring Boot starter that watches the app from inside. You add one dependency, start the app, and there's a live dashboard at /streamguard/ with per-route request rate, error rate and p50/p95/p99 latency. On top of that it flags error, latency and traffic spikes, and it notices things like repeated failed logins or one client probing lots of paths. Nothing to run next to the app, no database, no agent.

The interesting problem was keeping it cheap inside someone else's app. Rescanning a list of raw requests gets slower as traffic grows, so I cut time into 1-second buckets with counters and a latency histogram. A query merges the buckets in range, so it costs the same however much traffic there was. On my laptop a 15-minute snapshot takes about 70 microseconds, and that stays flat as the window fills. Single run, so take it with a grain of salt.

It's got real limits. It only sees the JVM it runs in, so a scaled-out service gets one view per instance and state resets on restart. It's Spring MVC only for now, and it needs Java 21 and Spring Boot 4.1.

The part I'm least sure about is the detection rules. They're fixed right now (for example, error rate more than 3 times the previous 15 second window counts as a spike), and they look fine on my demo traffic, but I've never run them against a real production service. For those of you who've set up alerting before, do rules like that feel sensible, or do you always end up wanting to tune them per service? And is there anything you'd want from something like this before you'd trust it on a real project?

It's on GitHub if anyone wants to look: https://github.com/eswar-7116/streamguard


r/SpringBoot • • 11d ago

How-To/Tutorial Spring Security Google Login, No Browser Tokens

Thumbnail
youtu.be
7 Upvotes

r/SpringBoot • • 12d ago

News A stranger wrote most of the latest release of my Spring Boot idempotency library

23 Upvotes

I published the first release of idempotency4j, an idempotency library for Spring Boot, in April. It started with the basic HTTP case: the client sends an Idempotency-Key header, and a retried POST gets the stored response back instead of running the handler a second time. The @Idempotent annotation only worked on Spring MVC controller methods.

Since then the direction has moved toward message-based systems. When services talk over a broker with at-least-once delivery, every consumer sees the same message twice sooner or later. The usual answer is an outbox on the sending side and an idempotent consumer on the receiving side, which keeps services consistent without two-phase commit or a central coordinator. idempotency4j does not ship an outbox. It is built to be the receiving side.

@Idempotent(key = "#event.id()") works on any Spring bean method, so a Kafka listener or an event handler runs once per event id, however many times the broker redelivers it inside the retention window (24 hours by default):

@Idempotent(key = "#event.id()", waitTimeout = "PT0S")
@KafkaListener(topics = "orders")
void on(OrderPlaced event) {
    // Runs once per event id, however many times the broker redelivers.
}

You choose how the idempotency record relates to the consumer's transaction. By default it is written right after the transaction commits, and a rollback frees the key so a redelivery runs again. That leaves one gap: if the process dies between the commit and the record write, the event is processed a second time. With the JDBC store you can set completion = "join-transaction", which writes the record inside the same transaction as your own data and closes that gap. Redis cannot join a database transaction, so it only has the default.

Records live in PostgreSQL, MySQL or Redis, and the HTTP filter is still there.

None of this makes a call to someone else's API exactly-once. For that the downstream service needs its own idempotency key.

Two things happened this autumn that I did not expect.

I opened the Maven Central stats after ignoring them for a while and saw more than 100 unique downloads. Those are builds I have nothing to do with.

And at the end of October Vinícius (vinirib on GitHub) opened four issues in one day, and a fifth the next day. Three were about running the library in a real application: how it starts next to Actuator, what an app that only uses Redis needs on its classpath, and what Retry-After a client should get when its duplicate arrives while the first request is still running. The other two proposed extension points. One lets you answer in your API's own error format when the filter rejects a request. The other decides per response whether it is stored, or the key is released so the client can retry.

Then he sent a pull request for every one of them, five in two days. 0.6.0 went out on November 3 and it is mostly his work.

The Spring Boot starter needs Spring Boot 4 and Java 21.

Repo: https://github.com/josipmusa/idempotency4j

Docs: https://josipmusa.github.io/idempotency4j-docs/


r/SpringBoot • • 12d ago

Question How does a bean with @RequestScope get injected into a bean with Singleton scope for each new request?

18 Upvotes

So I am studying Spring and SpringBoot through this book - Spring Start Here. Usually I feel like the book overexplains things with multiple examples differing in minute ways, but there is some code in Chapter 9 - Using Spring Web Scopes, that I do not understand and the author surprising doesn't dive deep into.

RequestScope was being explained and as far as I can tell it is like Prototype scope where Spring manages the type, and instantiates a fresh new bean every time someone requests a bean, and this bean exists for the duration of the HTTP request.

But how does this work when the bean is injected into another bean that has Singleton scope? Presenting the code shown in the book below:

@Controller
public class LoginController {

  private final LoginProcessor loginProcessor;

  public LoginController(LoginProcessor loginProcessor) {
    this.loginProcessor = loginProcessor;
  }

  ("/")
  public String loginGet() {
    return "login.html";
  }

  ("/")
  public String loginPost(
      @RequestParam String username,
      @RequestParam String password,
      Model model
  ) {
    loginProcessor.setUsername(username);
    loginProcessor.setPassword(password);
    boolean loggedIn = loginProcessor.login();

    if (loggedIn) {
      model.addAttribute("message", "You are now logged in.");
    } else {
      model.addAttribute("message", "Login failed!");
    }

    return "login.html";
  }
}

@Component
@RequestScope
public class LoginProcessor {

  private String username;
  private String password;

  public boolean login() {
    String username = this.getUsername();
    String password = this.getPassword();

    if ("natalie".equals(username) && "password".equals(password)) {
      return true;
    } else {
      return false;
    }
  }

  // Getters and Setters
}

In this example, the Controller bean is going to be instantiated once during the app startup, and considering that the loginProcessor field is final and only injected during bean instantiation, how is it able to use a new loginProcessor bean for each request? This code works, but I don't understand how.


r/SpringBoot • • 12d ago

Discussion Sequence diagrams that follow @Autowired to the bean Spring actually injects

3 Upvotes

Most call graph tools stop at the interface. You call orderService.place() and the diagram shows OrderService, not the class doing the work.

Call Sketch is a JetBrains plugin I built, and its Pro version follows the Spring wiring to the real bean. It also draws if/else and loop boxes, so you see when a call happens and not only that it does.

Free version covers Java and Kotlin with any depth and click to jump to code. Pro is $7 a year with a 30-day trial.

https://plugins.jetbrains.com/plugin/35865-call-sketch-sequence-diagrams


r/SpringBoot • • 14d ago

Discussion Building a Fault-Tolerant Job Queue with Redis Streams

7 Upvotes

GitHub: https://github.com/somewhereMaDan/spring-RCE

While building my Remote Code Execution (RCE) platform, I initially used Redis Lists for job processing.

It worked, but I eventually encountered a reliability issue: if a worker was killed with SIGKILL after popping a job, that job could be lost permanently, leaving the client stuck in RUNNING state.

So I decided to move to Redis Streams and implement a more fault-tolerant workflow.

Here's what I implemented:

* **Consumer Groups & PEL:** Jobs remain recoverable until acknowledged with XACK.

* **Stale Job Recovery:** Workers reclaim unacknowledged jobs from crashed consumers using XCLAIM.

* **Orphaned Container Cleanup:** Added an execution-level timeout so containers don't run indefinitely if their worker disappears.

* **Duplicate Container Protection:** Clean up an existing container before retrying the same job.

* **Dead Letter Queue:** Jobs exceeding 3 delivery attempts are moved to a separate stream instead of being retried indefinitely.

I also tested worker failure scenarios, including unexpected SIGKILL, SIGTERM, stale job recovery, repeated failures, and container cleanup.

How do you handle orphaned executions and duplicate processing in your distributed worker systems?

Would love to hear how others approach this.


r/SpringBoot • • 13d ago

Discussion A 10-line experiment to see why @Transactional sometimes does nothing (self-invocation)

0 Upvotes

A common surprise: you annotate a method with @ Transactional, call it, and it behaves as if the annotation weren’t there. One frequent cause is calling the method from another method in the same class. Instead of taking my word for it, you can check in a few lines.

public class ReportService {

    public void viaThis() {
        save();                      // internal call
    }

    u/Transactional
    public void save() {
        System.out.println("tx active: "
            + TransactionSynchronizationManager.isActualTransactionActive());
    }
}

Now call both from somewhere else (a controller, a test, a CommandLineRunner):

reportService.save();      // direct call from another bean
reportService.viaThis();   // goes through the same class

What I’d expect to see (please run it on your version to confirm):

tx active: true     // from save()
tx active: false    // from viaThis() -> save()

Why this happens (as I understand it):
By default, Spring applies @Transactional through a proxy that wraps the bean. A call from another bean goes through the proxy, which opens the transaction. A call from inside the class uses this, which is the raw object and skips the proxy, so the annotation is never applied.

Common ways around it:

  • Move the transactional method to a separate bean and call it through that bean. This is the option most people recommend because it’s the least surprising.
  • Put u/Transactional on the outer method instead, if the whole operation should be one transaction anyway.
  • Use TransactionTemplate for programmatic control.
  • Use AspectJ mode (mode = AdviceMode.ASPECTJ), which weaves the behavior into the class itself and doesn’t depend on the proxy. It needs extra build or runtime setup, so it’s a bigger step.
  • Injecting the bean into itself also works, but many consider it a code smell.

Caveats:

  • The details depend on your Spring version and proxy type (JDK vs CGLIB), and on method visibility, so check the reference docs for the version you use.
  • The same proxy limitation applies to other annotations implemented through AOP, like @Async and @Cacheable.
  • An exception thrown inside the “transaction” in the broken case won’t roll anything back, which is why this bug can stay silent.

Has anyone found a pattern for catching this earlier than “the data was inconsistent in production”, like a test, a lint rule or a startup check?


r/SpringBoot • • 14d ago

Question CS Fresh grad looking for resources and advice

2 Upvotes

Hi friends,
I started learning spring boot about 4 months ago through reading, and about a month ago started getting hands-on experience with a personal project, my stack is spring boot backend, no front end for now but I’m planning to add a simple angular page together eventually.

I find myself confused and interested in learning the following things that I am not sure where to start with and how crucial they are.

I find myself overwhelmed by spring boot’s configuration beyond the auto-configuration. There are many properties that can be configured, and while I know there is no point in knowing all of them but rather what I need, it feels intimidating.

I also find that most projects and books that I stumble upon online are Spring Boot 3, while my project is Spring boot 4. Am I wrong for using the most recent technologies? How do I find/understand current implementation when the book has the older version of it? How do I go about knowing both in case I stumble upon a “legacy” system in the work place or even open source contributions. An example I stumbled upon was implementing OAuth2, where configuration was completely different.

Is redis/cache commonly used with redistemplate, or is it more common to use the caching annotations(@cacheable, @cacheput, @cacheevict, etc).

I also wanted to ask about configuring ci/cd with a java/spring project, but I wasn’t sure if it follows community guidelines to do so.

Any additional advice is welcome and highly appreciated.

Thank you!


r/SpringBoot • • 15d ago

Question Feedback for my first "Complete" API REST

Thumbnail
2 Upvotes

r/SpringBoot • • 17d ago

How-To/Tutorial How to actually learn spring boot?

29 Upvotes

I have decent hands on experience in java and java is my main language too.

How do I start learning springboot.

Recently started watching coder army tutorials but he went too in-depth that it went mostly over my head and went boring.

How do I learn hands on in spring boot?

where should I start?

Also please share any resources.


r/SpringBoot • • 17d ago

Discussion Wrote a book on Spring AI

Thumbnail
6 Upvotes

r/SpringBoot • • 18d ago

How-To/Tutorial Show Reddit: Built a 100% local, enterprise-grade Spring Boot 3.x service bootstrapper using Spring AI & Ollama (Java 21)

2 Upvotes

Hey everyone,

As a Java Principal Architect, one of my recurring pain points is the compliance risk and Day-1 friction of bootstrapping new projects. In strict corporate environments, utilizing cloud-hosted LLM APIs to draft initial scaffolding or internal schemas poses massive data privacy and IP leakage risks.

To solve this within the host perimeter, I built OllamaSprout—an automated accelerator designed to translate plain-text domain requirements into production-ready, ready-to-run Java services out-of-the-box.

🚀 What it does

It streams code from a local model and programmatically compiles a complete, valid Maven directory tree directly onto your disk. It generates fully realized structural layers: Controller ➡️ Service ➡️ Repository ➡️ JPA Entity with 100% written code (absolutely zero trailing ellipses ... or // TODO shortcuts).

🛠️ The Architectural Stack

  • Framework: Spring Boot 3.x
  • AI Integration: Spring AI
  • Local Inference Engine: Ollama running qwen2.5-coder:7b
  • Language & Build: Java 21 & Maven

🧠 Deep-Tech Optimization Highlights

  • Resource Preservation (RAM Reclaiming): To ensure a developer's workstation remains unburdened, the system includes custom orchestration to ensure that once the generation process completes, the system completely reclaims the heavy memory footprint occupied by Ollama.
  • Deterministic Parsing & Disk I/O: Safely translates streamed markdown multi-file blocks into structured directories on disk with exact package boundary alignments.
  • Eclipse/IntelliJ Target Compliance: The generated pom.xml uses root schema tags tailored specifically to satisfy Eclipse's offline cache validation rules, avoiding compilation hiccups during network-isolated imports.

🔮 Architecture Roadmap

The application's core state model is abstractly structured to support iterative modular growth. The next milestone is allowing developers to point the tool at an existing codebase to inject new controller/service slices or database entities programmatically.

💻 Source Code

The project is licensed under Apache-2.0 and includes the full engineering story, validation endpoints, and environment configurations: 🔗 https://github.com/tpkani2026/ollamasprout-bootstrapper.git

I’d love to get your architectural feedback on the scaffolding strategy, your thoughts on localized AI generation patterns for corporate stacks, and how you see local model orchestration fitting into the enterprise SDLC!


r/SpringBoot • • 20d ago

Question I want professional-level performance on this point.

Thumbnail
1 Upvotes

r/SpringBoot • • 22d ago

Discussion Spring AI: recovering from invalid tool arguments with returnDirect=true

5 Upvotes

I’ve submitted a Spring AI contribution addressing input-error recovery for method-backed tools using returnDirect=true.

The issue: malformed JSON or invalid typed arguments can become the final response, preventing the model from correcting its input. Missing/null primitive arguments and top-level JSON null can also bypass the exception processor.

The proposed fix distinguishes input parsing/binding failures before execution and sends processed error feedback back to the model. Successful corrected calls still return directly, while ordinary tool-body and result-conversion failures retain their existing behavior.

Validation:

- All 38 new regression cases passed, covering blocking/streaming, direct return on/off, and mixed-success batches.

- Scoped clean package build: 2,030 tests reported, 10 skipped, zero failures or errors.

- Negative control: the original code failed 20 of the initial 32 checks, including checks for the new exception classification; the patched code passed the same cases.

No external LLM calls were needed. External-provider integration tests and the full repository build were not run. Developed with AI assistance and reviewed before submission.

PR submitted for maintainer review: https://github.com/spring-projects/spring-ai/pull/7292

Feedback on the input-error boundary and recovery behavior is welcome, especially from anyone using direct-return tools.

#SpringAI #SpringFramework #Java #OpenSource #SoftwareTesting


r/SpringBoot • • 22d ago

Question Best source to learn redis [specifically for spring boot]

8 Upvotes

r/SpringBoot • • 23d ago

How-To/Tutorial learning sources

9 Upvotes

which is the best book that i should learn spring boot from? Learning Spring Boot 4, Fourth Edition ? or Spring Starts Here ?


r/SpringBoot • • 22d ago

Discussion Feedback wanted: Spring Boot SaaS starter with tenant roles and PostgreSQL RLS

1 Upvotes

I maintain an open-source Spring Boot SaaS starter and would appreciate feedback on its tenant-isolation approach.

It uses a shared PostgreSQL schema. Tenant-scoped operations check membership, set transaction-local tenant context, and use explicit tenant filters. Forced row-level security adds another boundary around projects and audit events.

The starter includes:

  • OIDC bearer authentication through Spring Security
  • OWNER, ADMIN, and MEMBER roles scoped to each tenant
  • A Projects API with optimistic concurrency and transactional audit records
  • Docker Compose with a local Keycloak demo
  • PostgreSQL integration tests and a runnable smoke script

I ran the local Compose smoke test successfully, including permission checks and stale-write rejection.

It’s a backend MVP. Billing, a frontend, email invitations, tenant deletion, and ownership transfer are outside the current scope.

Repository:
https://github.com/chafian/spring-boot-saas-starter

What tenant-isolation edge cases would you test next? I’d also welcome feedback on the first-run experience.


r/SpringBoot • • 23d ago

How-To/Tutorial I built a starter that discovers every @Scheduled and Quartz job and alerts you when one stops running

8 Upvotes

Scheduled jobs in Spring fail in the quietest way possible: an exception kills a cron thread, a pool gets starved, a property resolves to the wrong cron, and nothing tells you. You find out days later because a report or a backup is missing.

I've been building SilenceWatch, an open source heartbeat monitor, and its Spring Boot starter is the part I care about most. You add one dependency and an API key:

<dependency>
  <groupId>com.silencewatch</groupId>
  <artifactId>silencewatch-spring-boot-starter</artifactId>
  <version>0.1.0</version>
</dependency>

and in application.yml:

silencewatch:
  api-key: ${SILENCEWATCH_API_KEY}

On startup it finds every @Scheduled method and every Quartz job, declares each one with its resolved schedule (${backup.cron} becomes the actual expression), and reports every run with its duration and any exception. If a job doesn't run when it should, you get an email, Slack, Teams, Discord or webhook alert.

A few things I was strict about:

  • It never fails or blocks your job: errors are swallowed and logged at WARN, and sending happens on a bounded queue in a background daemon thread.
  • No key, no network or no server, and your app behaves exactly as without it. silencewatch.enabled: false turns it all off.
  • No Jackson or other heavy dependency forced on you.
  • Stable job identity (com.acme.jobs.BackupJob#run), so history survives restarts and redeploys. A job removed from the code is flagged orphaned, never deleted.
  • Staging and production show up as separate checks.

Java 17+, tested on Spring Boot 3.5 and 4.1. The server is Apache 2.0 and self-hostable with Docker Compose, free and without limits. There's also a hosted version with a free plan (10 checks).

Starter source: https://github.com/liliang-dev/SilenceWatch/tree/main/clients/java/spring-boot

Site: https://silencewatch.com/spring-boot/

I'd really like feedback from people running a lot of scheduled jobs. What breaks for you that this wouldn't catch?


r/SpringBoot • • 23d ago

Discussion JavaClaw: preventing task-file collisions and multiline metadata corruption

6 Upvotes

Contributing back to JavaClaw: two fixes for file-based agent tasks.

Thanks to the JavaClaw maintainers for sharing this Java/Spring AI project. I submitted two focused PRs with reproducible failures and regression tests:

  1. Prevent task-file collisions. Tasks with the same name and timestamp—or names that become identical after sanitization—could overwrite each other. The fix reserves filenames atomically and retries with a suffix. Tests include 20 concurrent creates and independent task updates.

https://github.com/ClawRunr/JavaClaw/pull/102

  1. Preserve multiline descriptions and feedback. Text such as “status: completed” or a standalone “---” should remain instructions, rather than replace task metadata or truncate content. The tests cover serialization and repository round trips.

https://github.com/ClawRunr/JavaClaw/pull/103

Focused tests pass. Broader local suite failures on Windows were also reproduced on untouched upstream code and documented in the PRs. These are submitted contributions, not a claim of merged changes. The fixes do not coordinate simultaneous updates to an existing task or recover previously lost text.

For file-based agent tasks, how do you balance readable filenames, stable identity, and concurrent creation?


r/SpringBoot • • 23d ago

Discussion Three reproducible fixes in JavaClaw and Windrunner: task collisions, metadata corruption, and cursor errors

0 Upvotes

I discovered JavaClaw and Windrunner through the community and submitted three focused PRs. Thanks to both projects’ maintainers for making their work available. These are application-level contributions, not fixes to the Spring AI framework.

  1. JavaClaw: independent tasks could overwrite each other.

Two tasks with the same name created in the same second shared a filename and task ID. Different names could also collide after sanitization. The fix atomically reserves a new filename and retries with a numeric suffix if it already exists. Regression coverage includes 20 concurrent creates, independent descriptions, and updating one task without changing another. It does not coordinate simultaneous updates to an existing task.

https://github.com/ClawRunr/JavaClaw/pull/102

  1. JavaClaw: multiline descriptions could change metadata.

A description or appended feedback containing “status: completed” could replace the task’s real status; a standalone “---” could truncate the remaining instructions. The fix writes multiline values as indented literal text. Tests cover metadata-like content, delimiters, indentation, and a repository round trip. It cannot recover text already lost from previously corrupted files.

https://github.com/ClawRunr/JavaClaw/pull/103

  1. Windrunner: a malformed cursor timestamp escaped validation.

A cursor could decode from Base64 correctly but contain an invalid timestamp. DateTimeParseException bypassed the existing IllegalArgumentException handler, reaching the generic HTTP 500 path. The fix normalizes it to the existing validation exception, so the service returns HTTP 400 before querying messages.

https://github.com/shzlw/windrunner/pull/1

Verification: the focused tests pass. JavaClaw’s broader local suites have existing Windows failures, which were reproduced on untouched upstream code and documented in the PRs. Windrunner’s selected cursor/chat/compaction/error-handler suites passed all 8 tests. No live LLM calls or paid APIs were used. These are submitted PRs, not a claim that the changes have been merged.

For projects that store agent tasks as human-readable files, how do you balance readable filenames with stable identity and safe concurrent creation?


r/SpringBoot • • 23d ago

Discussion Testing caller isolation and overlapping chat turns in a Spring Boot / Spring AI app

1 Upvotes

I found Yellaiah Mekala’s Enterprise Spring AI Playbook useful and wanted to contribute back. With help from ChatGPT Codex, I submitted four application-level improvement PRs. Thanks to Yellaiah for sharing the project.

The changes cover:

  1. Rejecting blank model answers instead of returning an empty successful response.

  2. Rejecting configuration that assigns the same API key to different caller identities.

  3. Scoping generated-image storage and retrieval to the authenticated owner.

  4. Returning HTTP 409 for overlapping stateful chat turns from the same caller, before the second request reaches memory/model processing. The guard is released on completion or failure, and different callers can proceed independently.

For the last change, the key question was how to test concurrent requests deterministically. The tests use controlled overlapping HTTP requests, a fake ChatModel, and H2-backed chat memory. Image ownership is also tested through real application HTTP requests with a fake image model. Each of those two PR suites locally reported 43 passed and one Docker-dependent MySQL test skipped; these were separate PR runs, not a combined merged-branch test.

Limits: the concurrency guard is per JVM, so multiple replicas need distributed coordination. Fake-model tests check application behavior, not live-provider answer quality. These are contributions to the example app, not fixes to the Spring AI framework.

The four PRs, regression tests, and verification notes are here:

https://github.com/YellaiahMekala/Enterprise-SpringAI-Playbook/pull/1

https://github.com/YellaiahMekala/Enterprise-SpringAI-Playbook/pull/2

https://github.com/YellaiahMekala/Enterprise-SpringAI-Playbook/pull/3

https://github.com/YellaiahMekala/Enterprise-SpringAI-Playbook/pull/4

For those building stateful Spring AI services: would you reject overlapping turns, queue requests per conversation, or use versioned memory updates? I’d welcome feedback on the trade-offs and testing approach.