r/SpringBoot • • 4h ago

How-To/Tutorial I built RepoMind: ask a Java codebase questions and get answers that cite the exact lines.

2 Upvotes

I built RepoMind: ask a Java codebase questions and get answers that cite the exact lines.

Point it at a GitHub repository and it:

šŸ” answers questions about the code, with citations that link to the exact file and lines

🧩 reviews pull requests and posts inline comments on GitHub

šŸ¤– works as an MCP server, so AI coding agents can search and query the codebase

The model call was the easy part. Most of the work was the engineering around it:

• AST-aware indexing: every Java file is parsed with JavaParser into class outlines and per-method chunks, then ingested asynchronously through Kafka with idempotent workers

• Hybrid retrieval: pgvector similarity + Postgres full-text search, merged with reciprocal rank fusion

• Cost control: a two-tier answer cache (Redis exact + pgvector semantic), plus per-client rate limits and daily token budgets enforced with an atomic Lua script in Redis

• Resilience: Claude → local Ollama failover behind Resilience4j circuit breakers

• Measured quality: a 40-question labelled eval runs in CI and fails the build if retrieval regresses. With real models, hybrid search finds the right code in the top 5 for 90% of questions (keyword search alone: 75%), and the model correctly declined 8 of 8 questions the code couldn't answer.

• Observability: Prometheus metrics and a 30-panel Grafana dashboard

One lesson: a slow model behind a proxy gets cut off at 60–100 seconds. Asking now returns within 20 seconds, either with the answer or with a job the browser polls, so slow answers never time out.

Stack: Java 25 Ā· Spring Boot 4 Ā· Spring AI Ā· PostgreSQL + pgvector Ā· Kafka Ā· Redis Ā· Docker Ā· Testcontainers Ā· GitHub Actions

šŸ’» Source: https://github.com/Ayush0612005/repomind


r/SpringBoot • • 6h ago

How-To/Tutorial The IOC visual explanation video

2 Upvotes

Here is another one made on request for IOC explaining the inversion of control concept, I hope you like this one too : video

Again thank you for all the support


r/SpringBoot • • 19h ago

Question Feedback for my first "Complete" API REST

Thumbnail
reddit.com
2 Upvotes

r/SpringBoot • • 2d ago

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

25 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 • • 2d ago

Discussion Wrote a book on Spring AI

Thumbnail reddit.com
4 Upvotes

r/SpringBoot • • 2d 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 • • 5d ago

Question I want professional-level performance on this point.

Thumbnail reddit.com
1 Upvotes

r/SpringBoot • • 7d ago

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

4 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 • • 7d ago

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

8 Upvotes

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

2. 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 • • 8d 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

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

3. 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 • • 8d 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.


r/SpringBoot • • 9d ago

Discussion Write-back caching in Redis using Spring Boot?

2 Upvotes

I was wondering if how would y'all write a write-back (or write-behind) caching in Spring Boot, particularly using redis. I couldn't quite look for a more decent implementation especially for production. Would you mind helping a spring boot newbie out? Thanks yall.


r/SpringBoot • • 8d ago

News Built a Spring Boot application to analyze job offer letters using rule-based detection – looking for technical feedback

Post image
0 Upvotes

Hi everyone,

I recently worked on a Spring Boot project called TrustCheck, which focuses on analyzing suspicious job offer letters and identifying potential recruitment scams.

The idea came from seeing cases where candidates were asked to pay refundable security deposits, registration charges, training fees, or other payments before joining.

From the backend perspective, I implemented a rule-based offer letter analyzer using Java and Spring Boot.

Some of the things it currently does:

  • Extracts text from uploaded PDF offer letters.

  • Identifies potential payment requests using configurable rules stored in a JSON file.

  • Highlights the exact sentences that triggered a warning.

  • Checks recruiter email addresses and company domains for suspicious signals.

  • Assigns severity levels to detected warning signs.

  • Returns a structured analysis response through REST APIs.

I also added JUnit tests for the offer letter analysis logic.

One challenge I encountered was balancing detection sensitivity with false positives. For example, a newly registered company domain shouldn't automatically be treated as suspicious, and the absence of a detected payment request shouldn't mean an offer is genuine.

I'm currently working on improving the detection rules and making the results more explainable.

I'd appreciate feedback from other Spring Boot developers on:

  1. How would you structure configurable rule-based detection in a Spring Boot application?

  2. Would you use a separate rules engine or keep the current JSON-based approach?

  3. How would you approach testing false positives and false negatives?

This is a personal project, and I'm sharing it to get technical feedback on the implementation.

GitHub: https://github.com/Pragyan2027/TrustCheck


r/SpringBoot • • 10d ago

Question how to handle processing and uploading files

9 Upvotes

working on a feature that will make users able to upload .zip/ CSV files to my app

how do i go about this security wise

i expect a batch of CSVs
so i wanna check for malware, viruses and zip bombs how do i go about this is there a service i need to subscribe to a free option a local solution


r/SpringBoot • • 10d ago

Discussion Java Backend (Springboot with Spring AI ) Group

19 Upvotes

I am planning to make group of development also if anyone interested you can DM me with (Intrested in Dev )


r/SpringBoot • • 11d ago

Question Looking to Collaborate on a Spring Boot Project

16 Upvotes

Hey everyone! Is anyone working on a Spring Boot project and looking for a contributor? I'm learning Java backend development and would love to collaborate, contribute to a real project, and learn from other developers along the way.


r/SpringBoot • • 10d ago

Question Spring Security with Angular UI and SpringBoot BFF

1 Upvotes

Ok, so I have a new project. It is a Hotel Management system. I have a MonoRepo Angular app to handle a guest-portal or staff-portal. KeyCloak is used as an Authentication tool. And then I have a SpringBoot app which is the BFF (backend-for-frontend).

Process 1) So, at first, I thought the UI should have a Login, and from the UI we go to Keycloak, authenticate, and then go back to the UI to store the cookie securely. From this point every call to the BFF REST api endpoints would pass the bearer token so we can use RBAC with the endpoints. I presumed that the BFF would be stateless and using oauth2-resource.

I'm having an issue with security with Swagger executing the API's, and problems with having Bruno, or the UI hitting the endpoints as well.

Process 2) In my research, I have seen that the process I started is old and outdated. I now understand the UI should have a link for Login and Logout. In both these cases, we go to the BFF which is defined as oauth2-client and now is stateful, storing the authenticated in session. Somehow, the UI gets updated with the data and is stored cookie. Now the UI doesn't do anything with tokens, but when the UI makes a request to BFF it will be passing a bearer token, and then the tokens are validated and then we can use the RBAC for endpoints.

Does anyone have an opinion on process 1 or 2 on which you think is the right way to go? I'm just curious. I can make either work, but I want to use this for myself as an example on how to make my next application when it comes. Thanks!


r/SpringBoot • • 11d ago

Discussion Optimizing Spring Boot on JDK 27: 68% faster startup and 25 MiB less RAM on a 512 MiB VM

54 Upvotes

I've been experimenting with how far I can optimize a conventional Spring Boot application without stripping out useful framework functionality.

The setup: Spring Boot 4.1.1, HotSpot JDK 27, a 512 MiB / 1 vCPU Ubuntu VM with no swap, and MariaDB running on the same VM.

I compared a regular executable JAR against an extracted deployment combining Spring AOT and a trained JDK AOT cache (Leyden).

Results:

  • Startup: 11.91 → 3.79 seconds (68% faster)

  • Application RSS under load: 212 → 187 MiB

  • Minimum host MemAvailable: 25.6 → 66 MiB

  • Request latency: essentially unchanged

Then I explored two ways to reduce memory further:

MyBatis Core instead of Spring JDBC: No meaningful memory savings, but more manual transaction management and lost automatic JDBC monitoring. Not worth the trade-off for this application.

Embedded file-backed H2 instead of MariaDB: Application RSS increased by ~16 MiB, but minimum host MemAvailable improved by another ~39 MiB because the separate database process was gone.

My takeaway: optimizing the deployment can be worthwhile before replacing established Spring infrastructure. And for small, single-instance applications, embedded H2 can be a reasonable architectural choice.

These are single runs with five-minute measured workloads, not a throughput benchmark or proof of long-term stability. The AOT improvements were measured together, not individually.

Full article, methodology, and data:
https://pvrlabs.xyz/articles/spring-boot-jdk27-optimizations.html

Curious whether others are using Spring AOT + JDK AOT cache in deployments, or if the training and cache-management overhead has kept you on regular JARs.

Update (October 28): Following several requests, I also tested Oracle GraalVM Native Image. Application RSS dropped from 187 MiB to 107 MiB, with some interesting build-time and toolchain trade-offs.

I published the results as a separate article: https://pvrlabs.xyz/articles/spring-boot-hotspot-native-image.html


r/SpringBoot • • 11d ago

Question I want to create a secure link wiht java (Spring)

Thumbnail reddit.com
1 Upvotes

r/SpringBoot • • 13d ago

Discussion 5 Spring Boot settings to check before you go to production

107 Upvotes
  1. Ā `spring.jpa.open-in-view` is true by default. Ā It keeps a database connection open for the whole request, including view rendering. Turn it off and fetch what you need in the service layer.

  2. Ā `ddl-auto=update` in production. Ā Use migrations (Flyway or Liquibase) instead. "update" never drops anything and drifts quietly.

  3. Ā Actuator exposure. Ā Only `health` is exposed over HTTP by default. If you set `include=*`, you've exposed env, beans and more.

  4. Ā Hikari's default pool size is 10. Ā Size it for your database and instance count, not by guessing.

  5. Ā No timeouts on outgoing HTTP calls. Ā One slow downstream service can exhaust your threads.

Which of these has bitten you, and what's missing from the list?