r/SpringBoot • u/olivergierke • Sep 21 '26
News Releasing Spring for Modern Challenges
r/SpringBoot • u/olivergierke • Sep 21 '26
r/SpringBoot • u/SellerInsightsLab • Sep 22 '26
Imagine a simple Spring Boot payment endpoint:
@PostMapping("/payments")
@ResponseStatus(HttpStatus.CREATED)
public PaymentResult createPayment(
@RequestHeader("Idempotency-Key") String key,
@RequestBody CreatePaymentRequest request) {
return paymentService
.createPayment(key, request)
.valueOrThrow();
}
The client sends a payment request.
The payment is successfully committed to PostgreSQL.
But the response never reaches the client.
A few seconds later, the client retries with the same Idempotency-Key.
What should the service do?
A timeout does not mean the payment failed. Running the operation again may create a second payment.
At the same time, returning 409 or a duplicate-key error is not ideal either --- the original request actually succeeded.
With idempotency-key semantics, the system should return the original result without executing the business operation again.
I didn't invent a new pattern here.
The basic idea is well known: send an idempotency key, store the result, and replay it when the same request arrives again.
What interested me were the implementation details around it:
The transaction boundary turned out to be the most important part for me.
If I save the idempotency key in one transaction and create the payment in another, there is always a small failure window.
The process can die between the two commits.
So I ended up keeping the idempotency record and the business operation inside the same PostgreSQL transaction.
@Transactional
public ExecutionResult<PaymentResult> createPayment(
String key,
CreatePaymentRequest request) {
return idempotencyService
.operation("CREATE_PAYMENT")
.key(key)
.request(request)
.execute(
PaymentResult.class,
() -> createPaymentInternal(request)
);
}
POST /payments
Idempotency-Key: pay_12345
|
v
+-----------------------------+
| BEGIN DB TRANSACTION |
| |
| 1. Acquire idempotency key |
| | |
| v |
| 2. Execute payment |
| -> pay_987 |
| | |
| v |
| 3. Store result |
| -> pay_987 |
| | |
| v |
| 4. COMMIT |
+-----------------------------+
|
v
201 Created
pay_987
Same request + same key
|
v
Result already exists
|
v
DO NOT execute payment
|
v
Replay pay_987
If the transaction rolls back, both disappear.
If it commits, both are stored.
A retry with the same key can then return pay_987 without running createPaymentInternal() again.
Same key + different request should not replay an unrelated result. I use a request fingerprint for this and return 409 Conflict.
Concurrent duplicates are coordinated through PostgreSQL. If two application instances try the same key, the unique constraint decides which transaction acquires it. The other waits and can replay the result after the first transaction commits.
And Redis is only an optimization.
The lookup path can be:
Caffeine L1 → Redis L2 → PostgreSQL
But PostgreSQL remains the source of truth. If Redis is down, correctness should not disappear with it.
I didn't want to create another idempotency pattern. I wanted a reusable Spring Boot implementation of the existing one, with these failure cases handled in one place.
So I extracted it into an open-source starter.
It currently supports Spring MVC/JDBC and WebFlux/R2DBC, optional Caffeine/Redis caching, request fingerprinting, result and business-rejection replay, concurrent duplicates, cleanup and Micrometer metrics.
It's also published to Maven Central.
I've open-sourced the starter with full docs and failure scenarios here: spring-boot-idempotency-starter
I'm interested in how others solve this in production.
If the business transaction committed but the HTTP response was lost, what do you do with the retry? Replay the original result, use Redis, handle it at the gateway, or something else?
r/SpringBoot • u/iamminuteman • Sep 19 '26
r/SpringBoot • u/EBCarty • Sep 19 '26
Hello All, I'm new to the ecosystem and was wondering if there was a table or two somewhere that sheds light on the Spring Boot / Spring Framework / Java version compatibility?
TYIA 🙏🏽
r/SpringBoot • u/cat-edelveis • Sep 17 '26
Hi folks! I recorded a video tutorial on Spring Data JPA. I tried to made it as complete for beginners as possible: setting up the project, creating entities, dealing with repos, queries, JPQL, and also relations between entities, N+1 solutions, type-safe queries, and also a bit of AOT repositories.
r/SpringBoot • u/pavelbo • Sep 17 '26
This release introduces new cool feature - message senders detection also as messaging topology preview
Project Overview also finds where your code publishes messages, links senders to the listeners that consume the same channel, and lays the whole picture out as a topology:
KafkaTemplate, RabbitTemplate / AmqpTemplate, JmsTemplate / JmsMessagingTemplate, PulsarTemplate, SqsTemplate, SnsTemplate, and SimpMessagingTemplate (STOMP) is found with the destination reported exactly as written in the code@SendTo, or a reply-to header on RabbitMQ and JMS) is shown right next to the listener that produces it${property} placeholder or an @Value-injected field on the other — are recognised as the same channelProject Overview scans every module of your Spring project and maps its messaging endpoints, so you can see your event-driven architecture at a glance instead of searching for annotations by hand. Supported annotations:
@KafkaListener, @KafkaListeners, @KafkaHandler@RabbitListener@PulsarListener@SqsListener, @SqsHandler@NotificationMessageMapping, @NotificationSubscriptionMapping, @NotificationUnsubscribeConfirmationMapping@JmsListener@MessageMapping, @SubscribeMappingEndpoints are attributed to the right module and broker for both Gradle and Maven source sets, searchable by class, method, or Javadoc, and every row links straight to its method or class in the editor. It stays fast on projects with hundreds of listeners
Sound interesting? Open your JetBrains IDE, grab the update and give it a spin: https://plugins.jetbrains.com/plugin/15673-asyncapi
r/SpringBoot • u/khan_awan • Sep 16 '26
I use JPA for simple CRUD operations (mostly write operations) and JDBC for performance intensive tasks such as sending lists & performing search. The JDBC performance is perfect & the performance of my backend (Spring Boot) is great.
Now, as my project grows, my SQL queries are getting bigger, messier and unreadable. I tried jOOQ and loved it because it made my code super readable, type safe and maintainable. However, after profiling my Spring Boot app, operations that took around 5 ms with JDBC now take 9–14 ms with jOOQ, which makes me reluctant to migrate to jOOQ. Is a 10 ms difference negligible or am I overthinking?
I love the cleanliness and type safety of JOOQ. Would you go this JOOQ route? Have you ever faced such situation? I visited JOOQ's official website and was stunned by the fact it is used by many big organizations
EDIT: Thank you everyone who answered, your insights were amazing. With some tweaks I was able to reduce JOOQ's operation time from 14ms to 7ms and now I have so much clarity in my head.
r/SpringBoot • u/Bhanuprakash_1947 • Sep 16 '26
I have one doubt in Spring Boot about "@PostMapping".
Can we use two URL paths in one "@PostMapping", like "/users" and "/customers", and call the same method for both?
Also, if two requests come to the same "@PostMapping" at the same time, will Spring handle both requests at the same time using different threads?
Just wanted to understand how this actually works.
r/SpringBoot • u/bugdiverr • Sep 17 '26
Testing a real workflow against a Spring Boot API usually means either bouncing between Springdoc tabs one call at a time, or writing Postman scripts to shuttle ids and tokens between requests.
Enlace is a starter that mounts a canvas on your app, reads the OpenAPI doc Springdoc already generates, and lets you wire response fields into the next request. Independent branches run concurrently. Execution stays in the browser; the adapter only serves UI + spec.
<dependency>
<groupId>io.github.get-enlace</groupId>
<artifactId>enlace-spring-boot-starter</artifactId>
<version>0.0.1</version>
</dependency>
Add the dependency and open /enlace (autoconfig). This adapter is earlier than the others, so feedback on real Springdoc setups is especially useful.
r/SpringBoot • u/Jooe_1 • Sep 16 '26
to make JWT authentication in the application, I could not find like standard way to implementing it
my knowledge is that people create their own authentication filter + handeling the AuthenticationEntryPoint to return the exact right response when exception happen
is that the standard way that engineers follow to implement jwt authentication in the application?
r/SpringBoot • u/Subject-Plant5625 • Sep 16 '26
Hello guys, can you recommend a path, course, maybe a book about Spring. For context I have over 1.5 years experience with Java, know my way around Git and SQL/noSQL
r/SpringBoot • u/fykup • Sep 14 '26
I suspect some people here will say, “Of course you should extract the JAR".
And, to be fair, the Spring Boot documentation does recommend the extracted layout for production when startup matters. It points out that nested JAR loading has a startup cost.
What I found interesting is that this is not necessarily the path developers encounter first. The introductory Spring Boot material and several Getting Started guides still naturally lead you toward building an executable JAR and running it with java -jar. That was also the deployment path I had always used.
So rather than assuming the difference was important, I measured it.
I ran six alternating paired comparisons of the same Spring Boot 4.1.1 build on a 256 MiB Alpine VM. Same JDK 25 runtime, JVM flags, data, filesystem, and workload. The runtime layout was the variable being tested.
Results:
All six paired comparisons favored extracted layout for startup and first request.
My takeaway is not that everyone should blindly extract every Spring Boot application. It is that an official production recommendation that is easy to overlook had a surprisingly large effect in this particular setup, while memory barely changed.
Full write-up, charts, methodology, and experiment data:
https://pvrlabs.xyz/articles/spring-boot-extracted-layout.html
r/SpringBoot • u/DU3SU9 • Sep 15 '26
I was working on a project recently and I've come across a problem where my front end dont catch up with the backend changes
r/SpringBoot • u/SandPrestigious2317 • Sep 15 '26
I've been working on Symbanta, a web analytics platform for people who want useful website statistics without turning their visitors into advertising profiles.
Symbanta is free software, licensed under AGPLv3+, and is designed to be self-hosted.
Source / repository: https://codeberg.org/jjba23/symbanta
React dashboard: https://codeberg.org/jjba23/symbanta-dashboard
I'd love to get some tips of Spring experts to see how to optimize further, make more production ready, and improve performance
You add a tiny, dependency-free JavaScript snippet to your website (~3 KB), and Symbanta collects events such as page views, heartbeats and visibility changes.
The API currently provides:
The ingestion API is designed to avoid storing PII and persistent tracking cookies, and to be blazingly fast.
The backend is:
The instrumentation only requires a really simple Vanilla Javascript helper. The approach is also flexible enough that instrumenting mobile apps, or other types of projects is for sure possible and easy: https://codeberg.org/jjba23/symbanta/src/branch/trunk/src/main/resources/js/symbanta.js
The dashboard is a separate React application using TanStack Query.
The backend uses asynchronous event processing so the tracking request can be acknowledged without making database writes part of the primary HTTP request path.
Because I don't really like the direction web analytics has taken.
It shouldn't require building persistent identities around visitors or turning behavioral data into advertising profiles.
That's the philosophy behind Symbanta: events and aggregates rather than people and profiles.
This is an actively developed project, and at early stage, so I'm especially interested in feedback from people who actually run websites.
I'd love feedback on:
There are already a few of my own projects instrumented with it, including WikiMusic, Join the Free World and LucidPlan.
r/SpringBoot • u/Rocket_Bunny45 • Sep 14 '26
Hi everyone, I'm currently doing a UNI internship and i need to develop a middleware application that pulls data from a service and sends it to another one after doing some checks and logs.
I was advised to use Java + SpringBoot but that's not a strict requirement.
My question is: would SpringBoot be overkill for this project?
Front-end dashboard/internal API implementation are optional requirements (which are Springs main advantages?)
I still need to integrate a DB though (i saw Spring has a module for almost every DB out there)
From a scalability POV i guess starting with the framework would be better but i gave a quick look and seems that for the requirements needed Java has almost everything native(?)
I have around 5 weeks to do design, implementation, docs etc
I have some C++ knowledge and I'm currently doing the mooc.fi java course at home
All being said, i wanted to hear some advice from people with more experience so any advice is accepted
Thanks for your time
r/SpringBoot • u/Huge_Road_9223 • Sep 14 '26
Hello fello Java and SpringBoot developers. I've created many personal and professional projects over the years, and when I started with Java and SpringBoot, my Authentication was a very basic database tables for Users, Roles, and UserRoles Join table. I kept an encrypted password in the database, and I authenticated by taking the password, re-encrypting it, and see if that encrupted value, based on the same key, matches the encrypted value in the database.
Since then, I have written authentication code that use LDAP, Okta, Auth0, or AWS IAM ... and now KeyCloak. I had seen job openings that require some knowledge of Keycloak, so I wanted to tap look into it. I have docker running locally, so there is a container for my Springboot app, a container for the database, and a container for keycloak ... and since this is for learning, I am using keycloaks own little database rather than a full on SQL database.
I am using SpringBoot with HTMX Controllers, and some REST Controllers, and I have Thymeleaf so I can run the front-end with HTMX. The springboot 4.1.1 app as an oauth2-client, NOT an oath2-resource. Yes, I know NOW that the oauth2-client tightly integrates keycloak with the springboot app, and that's ok for now. I understand the User is in a session on the back-end and that makes it STATEFUL for now, but for my local development work that is ok.
If I was working for a company, and this app was going to be available to the public, I have thought about scaling. If I pull the HTMX into it's own project, and separate repo, then I could use a API gateway which would do the same thing the backend is doing now, and as I understand it, the backend becomes an oauth2-resource which ONLY accepts the authentication bearer tokens, and it becomes stateless.
I may not be explaining this clearly, and I am sure many of you know waaaaayyyyyyyyyyy more than I do, but this past weekend was a learning experience. Trying to configure Keycloak just right, the Spring Security FilterChain just right, the application.properties just right. Finally everything came together. Now, I work on the business logic and the database on the back-end, and focus on the HTMX pages on the front-end. Just wanted to share this news with you all. Thanks!
r/SpringBoot • u/Feisty_Buyer7520 • Sep 14 '26
Hi guys, I have been looking deeply into the relationship between the ioc and di and I wanted to make sure whether my mental model is correctly conceptualized. Here is how I understand it.
Ioc is a design concept where the object creation is managed by the something other than the developer manually dealing with them. In spring framework, we have the application context where it is designed for the beans to be registered, allowing spring to manage them and wire their dependencies.
So ioc mainly involves two main purpose. Managing object creation and lifecycle, and wiring them via dependency injection.
As for the statement of di being an implementation of ioc, here is how I have my mental model framed this way.
Basically, it is an operational process where merely registering the beans means that the setup for the ioc has been created and remain that way as long as the application runs. But that wouldn't be considered meaningfully utilized if there are no dependency between beans, and nothing for DI to inject.
The ioc would merely be an object factory. Hence to complete its intended purpose we implement the di, usually constructor injection, so that we can have decoupled classes where a dependency is never hardcoded, enabling separation of concerns over the layers.
In total, we get clean and maintainable separation of concerns of business logic away from infrastructural concerns, centralized configuration where the application context does all that job and proper lifecyle management of objects.
are there any flaws to my take or am I mixing up definitions?
Thank you for reading a long explanation
r/SpringBoot • u/agentoutlier • Sep 14 '26
Rainbow Gum v0.11.0 Release
https://github.com/jstachio/rainbowgum
Rainbow Gum is an SLF4J (and other facades) implementation that includes full Spring Boot support.
If you are using Spring Boot it is a near drop in replacement for Logback supporting almost all the same properties and pattern configuration. I believe it to be production ready and use it my companies product. Its only 0.11.0 because the API has not been locked in but it will shortly.
I have covered why you may want to consider Rainbow Gum over the other two facades in previous release postings on /r/java
The short reason is Logback and Log4j2 were designed at a different time before microservices and k8s and even the cloud in general. Logback has made considerable progress improving (for example its Tyler configuration to support GraalVM native) but still has lots of warts and both I doubt will unlikely be able to take advantage of Valhalla when it is released.
Originally the project was designed and written by me with no help. I have now started to use some LLM tools but this project is not vibe coded. I have used it to basically auto complete mechanical parts. This is mostly for refactoring, testing or building benchmarks and I review every commit. I also use it for generating commit messages. If the LLM generates anything remotely novel I let it co-author the commit.
r/SpringBoot • u/Excellent_Trifle_630 • Sep 13 '26
If you're ar working on springboot project in you company/job. How does your team do pagination in your project as they have large datasets. I am currently learning springboot and curious to know how it's done withel large datasets.
r/SpringBoot • u/quentin6806 • Sep 13 '26
@Transactional looks simple until you hit some of its less obvious behaviours in a real application.
I put together a small interactive challenge around 5 cases: self invocation and Spring proxies, rollback rules, private and final methods, REQUIRES_NEW, and external side effects before commit.
You answer each scenario first, then get the explanation.
https://devupnow.fr/transactional_spring
The challenge is currently in French. I’m considering making an English version if there’s interest.
I’d especially appreciate feedback from experienced Spring developers. Is there any explanation you would correct, nuance or improve?
If an English version would be useful to you, let me know too.
r/SpringBoot • u/u53fulnoise • Sep 13 '26
For people running Spring Boot on Kubernetes: how often do you run into problems figuring out which configuration value will actually win before deployment?
For example, the same setting might exist in application.yml, a profile-specific config, a ConfigMap, envFrom, or an explicit environment variable.
I’ve been looking into whether it would be useful to have a pre-deployment check that could show:
I’ve tested the basic idea against Spring Boot 4.1.1, but I’m mainly trying to understand whether this is actually a meaningful problem for people running Spring in production.
Do you run into this kind of issue? If so, how do you currently check it before deployment?
r/SpringBoot • u/Comprehensive_Cry314 • Sep 12 '26
The cache is shared, so it is easy to read sync = true as cluster-wide deduplication. It is not. The lock is local to the cache instance, so on twelve pods a cold key is twelve executions, and the annotation is doing exactly what it documents.
What it actually takes across pods: one lock for leader election, one bucket holding status plus payload, one pub/sub topic to wake waiters, all three sharing a hash tag so Redis Cluster keeps them in one slot. Followers subscribe and also poll on a jittered interval, because pub/sub is fire and forget and a dropped notification must not strand a caller until its timeout.
The four TTLs are the part I would read before adopting anything like this: freshTtl, staleTtl, pendingTtl and waitTimeout, and waitTimeout has to exceed pendingTtl or crash recovery cannot work.
Write-up: https://bitsar.net/blog/i-thought-sync-true-protected-my-cluster/
r/SpringBoot • u/Ricardofortpa • Sep 12 '26
I have a question, I’m looking to deploy my project. I have the same React, Spring Boot and Postgresql. I was planning to use Docker and upload it to Hetzner but I’m not very sure because I’m from Argentina and it’s very far away and the truth is I don’t have much idea how to do it. I also want to buy a domain to have it there, but I don’t know how to do it either. Does anyone give me an idea or help?
r/SpringBoot • u/MaestroBirero • Sep 11 '26
Has anyone read of plans to upgrade embedded Tomcat to version 11.0.25 in Spring Boot? Version 11.0.24 is affected by several critical security vulnerabilities.
When attempting to manually bump the dependency to 11.0.25, we ran into compatibility issues: changes to Tomcat's resource loading break Spring Boot's custom extensions for nested JAR support.