r/SpringBoot • • Apr 16 '24

Securing Spring Boot 3 Applications with Spring Security 6.1 and Beyond

Thumbnail
unlogged.io
25 Upvotes

r/SpringBoot • • Dec 14 '22

Difference between DTO and Entity and DAO

25 Upvotes

Hi, I am learning Spring Data JPA and confused on some classes.

Could someone please explain the differences between above mentioned class types? The resource where I am learning it has not explained much about it, but I see that the class structures are similar between DTO and Entity. DTO class has a static method which returns customerentity and vice versa with entity class too.

Couldn't find any sub on spring data so posted here.


r/SpringBoot • • Feb 25 '20

Netflix Built a Spring Application Generator to Boost Dev Productivity.

Thumbnail
spring.io
25 Upvotes

r/SpringBoot • • 16d ago

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

24 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 • • Sep 12 '26

Discussion @Cacheable(sync = true) with a Redis cache manager still lets every pod call the downstream once

24 Upvotes

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/

Code: https://github.com/BitanSarkar/coalesce-java


r/SpringBoot • • Jun 26 '26

Question Best Spring Boot resources to learn quickly?

24 Upvotes

Hi everyone,

I'm a 4th-year engineering student, and I want to learn Spring Boot as quickly and effectively as possible. I don't have a lot of time left before drives, so I'm looking for resources that are practical and focused rather than overly theoretical.

I'm comfortable with Java basics and now want to build real-world backend applications using Spring Boot.

Could you recommend:

  • The best YouTube channels

  • Paid or free courses

  • Books (if they're worth the time)

  • Official documentation

  • GitHub repositories with real projects

  • A project-based learning roadmap

If you were in my position with limited time, what resources would you prioritize to become industry-ready as fast as possible?

Thanks in advance for your suggestions!


r/SpringBoot • • Jun 23 '26

How-To/Tutorial Building with the Latest Java Development Stack: Spring Boot 4.1.0, Java 25, Docker 29.5.3, PostgreSQL, Gradle 9.6.0, Eclipse 2026–06, Swagger/OpenAPI, Serenity, Cucumber, and JUnit 6

24 Upvotes

I recently updated my hands-on tutorial on building a complete working project with the latest Java development stack.

The article covers Spring Boot 4.1.0, Java 25, Docker 29.5.3, PostgreSQL, Gradle 9.6.0, Swagger/OpenAPI, Serenity, Cucumber, and JUnit 6 — all combined in one practical project.

The goal was to use the latest versions across the stack and show how they work together in a real Spring Boot application, using a vibe-coding approach.

Article title:

Building with the Latest Java Development Stack: Spring Boot 4.1.0, Java 25, Docker 29.5.3, PostgreSQL, Gradle 9.6.0, Swagger/OpenAPI, Serenity, Cucumber, and JUnit 6

A practical hands-on tutorial showing how to combine the latest Java, Spring Boot, Docker, PostgreSQL, Gradle, Swagger/OpenAPI, Serenity, Cucumber, and JUnit 6 in one working project using a vibe-coding approach.

Link:

https://medium.com/@anatolykrivitsky/quick-tutorial-how-to-use-the-latest-docker-29-5-2-0670b716b6cc?postPublishedType=repub

Hope it is useful for Spring Boot and Java developers.


r/SpringBoot • • May 30 '26

News I built a Spring Boot runtime anti-pattern detector – found real issues in eugenp/tutorials

24 Upvotes

I built java-vibe-guard, an open-source tool that scans Spring Boot projects for runtime anti-patterns that often compile, pass tests, and only become visible under production load.

During validation against real-world repositories, including eugenp/tutorials, it detected patterns such as:

- u/Transactional on u/RestController

- Reactor .block() usage in reactive code paths

- Blocking operations inside u/KafkaListener methods

- JPA N+1 query patterns

- Connection pool starvation risks

Current status:

- 7 Spring Boot runtime rules

- 102 tests

- CLI (npm)

- MCP server for Claude Code

- Validated across 17,137 files from 10 Spring Boot repositories

I'm especially interested in feedback from teams using AI-assisted development. Have you seen recurring production issues introduced by LLM-generated code?

Note: The tool flags patterns based on static analysis — it does not execute the code or run load tests. False positives are possible and feedback is welcome.

Repo: https://github.com/Joaquinriosheredia/java-vibe-guard


r/SpringBoot • • May 22 '26

Question Spring Cloud or just K8s

24 Upvotes

Is spring cloud still relevant? Like spring cloud config, Eureka, cloud gateway? Or should i just learn K8s for services registery/discovery instead of Eureka, K8s's ConfigMap instead of Dedicated config server, i might stilll keep Spring Cloud Gateway, etc. And which one is mostly used in the industry?


r/SpringBoot • • Apr 27 '26

How-To/Tutorial Spring Data JPA with Kotlin: Definitive Guide

Thumbnail
protsenko.dev
24 Upvotes

More than 6 years I worked with Spring on Java, but last year was a different - I switched to Kotlin and I absolutely loved it. With power of Kotlin I could produce maintainable code without one million null pointer validation and able to write idiomatic and laconic code.

I have a lot of material on best practices for Spring Data JPA but for Java, it took a time to write about Kotlin, it's probably the biggest article I ever wrote - 29 minutes, 5.5 k words to read covering all the different aspects of programming with Kotlin and its Best Practices adopted to my beloved language.

From time to time it looks a bit like a documentation but I wanted to minimize count of text and write more things that need attention in a cheetsheet format. So, feel free to share your feedback


r/SpringBoot • • Mar 11 '26

News Spring CRUD Generator v1.5.0 is out — better spec consistency, CI integration tests, and AI-friendly autocomplete

24 Upvotes

Hi everyone! I’ve just released Spring CRUD Generator v1.5.0.

It’s an open-source Maven plugin that generates Spring Boot CRUD code from a YAML/JSON config - entities, DTOs, mappers, services, controllers, Flyway migrations, Docker resources, OpenAPI support, and more.

This release is mainly focused on consistency, generator reliability, and better developer experience. One nice addition is that the project now works better with GitHub Copilot and autocomplete, so editing generator specs feels more AI-friendly than before.

What’s new

  • fixed basePath vs basepath inconsistency

  • basePath is now the documented form

  • basepath is still supported, but deprecated

  • added integration tests to the generator project

  • integration tests now run in GitHub CI to catch inconsistencies in generated code earlier

  • added relation.uniqueItems for generating Set-based OneToMany and ManyToMany relations

  • fixed missing List / Set imports in business services for JSON<List<T>> and JSON<Set<T>>

  • improved GitHub Copilot support + autocomplete for the project

  • added security policy

  • updated documentation to be more readable

Repo: https://github.com/mzivkovicdev/spring-crud-generator Release notes: https://github.com/mzivkovicdev/spring-crud-generator/releases/tag/v1.5.0 Demo repo: https://github.com/mzivkovicdev/spring-crud-generator-demo

If anyone wants to try it, I’d love feedback.


r/SpringBoot • • Feb 15 '26

Discussion What should one learn in 2026 to hired with JAVA stack?

24 Upvotes

What one should learn in 2026 to get a Job with JAVA stack ?

hello everyone.

I'm in final semester of engineering in a tier 3 college with polymath/multitalented, most of the companies hiring are looking for MBA Mcom grads in my Uni so does some of the companies in engineering dept woth a "sales required" as note.

i have been into programming since November 2024 (approx 15-16 months) and i have learned react decently for about 5-6 months with the basics html css js tailwind and all but then moved to Java as a better alternative with a less saturated market demand and aso out of annoyance with frontend, but i still know some react and it won't take more than a week or two to revise everything up and make decent frontends but i am hoping for more more jobs in Java, since i have learned Java then Springboot, Spring data, how spring mvc works, worked with REST apis and now postgres but I am still confused where should i spend last 4-5 months of my bachelor's to get a good job (anything above 30-35k).

i have been recommended Docker, Microservices etc but i feel i don't have a practical DSA knowledge beside two semester subjects. any suggestions?


r/SpringBoot • • Jan 22 '26

How-To/Tutorial Spring Boot Project – Day 7: Implemented Pagination & Sorting at Service and API Level

24 Upvotes

Spring Boot Backend Project – Day 7 🚀 Today I worked on handling large datasets efficiently by implementing pagination and sorting across the service and controller layers. What I implemented: Defined pagination & sorting contracts in the service interface Implemented pagination logic using PageRequest and Sort Added flexible sorting support (field + direction) Integrated pagination & sorting parameters into REST APIs Built navigation logic in the controller for clean API design Tested APIs using Postman with real query parameters Ensured scalable data fetching for large record sets (1000+ rows) The goal here is to move beyond basic CRUD and design APIs that are production-ready, scalable, and aligned with real-world backend requirements. I’ve also uploaded a detailed walkthrough of this implementation on my YouTube channel where I explain the design decisions and code step by step. You can find the YouTube link in my Reddit profile bio if you want to check it out. As always, I’d appreciate feedback or suggestions on: API design Pagination best practices Sorting strategies in Spring Boot Thanks for reading 🙌


r/SpringBoot • • Jan 08 '26

How-To/Tutorial How to Run Background Jobs in Spring Boot 4 with JobRunr (Full Tutorial)

Thumbnail
youtube.com
24 Upvotes

I noticed that our "Spring Boot Starter" page is the most read page on our JobRunr documentation. So I decided to make a short video tutorial about it.

If you are looking to replace your standard schedulers with a persistent job scheduler that can handle distributed environments and has a built-in dashboard, then this might be something for you.

We build a small banking scenario to demonstrate:

✅ Fire-and-forget jobs (Welcome bonuses)

jobScheduler.enqueue(() -> bankService.startOnboarding(name));

✅ Persistent scheduling (Future charges)

jobScheduler.schedule(LocalDateTime.
now
().plusDays(14), () -> chargeMembershipFee(clientName));

✅ Recurring tasks (Nightly interest)

BackgroundJob.scheduleRecurrently("interest-job-id", Duration.ofSeconds(60),) -> bankService.applyDailyInterest());

or using the annotation

@Recurring (interval = "PT3H [PTOS/PT1H]", id = "apply-daily-interest" )

Let me know what you think of our Youtube tutorial. We are still learning how to make them most valuable to the community.


r/SpringBoot • • Oct 27 '25

Question What makes spring the industry standard? Other than java and the initial market cap

24 Upvotes

.


r/SpringBoot • • Jun 30 '25

Question How much faster are native/JPQL queries compared to JPAs methods?

24 Upvotes

Title, how faster and when should i use custom queries instead of JPAs methods? I find it hard to visualize how much faster they are compared to JPAs methods. I tend to think that they are better used in loops/batch, please enlighten me


r/SpringBoot • • May 25 '25

Discussion I made a simple JWT Authentication backend. Any critiques?

24 Upvotes

Hello, I created a small backend service that provides JWT authentication and has one protected endpoint that requires a valid JWT token. I’m very new to spring security, can anyone give me some advice on how to improve it?

https://github.com/jmoser2004/JwtSpringbootDemo

Edit: Thank you everyone for your advice and suggestions! I will be sure to implement them the next time I am at my laptop. Thank you again!


r/SpringBoot • • May 10 '25

Question Open source

24 Upvotes

Could you Guys suggest me some Open source projects using spring Boot on which i can contribute


r/SpringBoot • • May 05 '25

Discussion Spring Boot and imposter syndrome

24 Upvotes

I'm coming to the end of my two-year vocational Java program, and to be honest, I'm struggling with some heavy imposter syndrome.

I completed my internship in a stack that had nothing to do with Java or Spring Boot – a decision I made during a tough job market with very limited options. While it gave me valuable insights, I’ve been feeling like I’ve fallen behind in what I should know as a Java developer by now.

To catch up and grow, I started building a CMS system in Spring Boot from scratch — it's being developed voluntarily for a small organization. The system will allow users to log in, manage users, and publish articles that are then delivered to a frontend via a backend API. I'm also exploring AI integration using OpenAI to assist with content generation.

I often find myself back at basic controller logic, feeling like I haven’t really advanced much over the past two years.I want to learn to build like the pros, structured, scalable, testable, and secure. But it's hard to know what “professional-level” really looks like, and how to get there on your own.

Do you have any tips on how to structure backend projects the way teams do in real-world settings?How do you approach learning when you feel like you’re “behind”?
And how do you deal with imposter syndrome when it hits hard?

Any advice, resources, or even just encouragement would mean a lot right now.


r/SpringBoot • • Mar 28 '25

Guide Spring AI tutorial for beginners

24 Upvotes

Hola everyone! 👋

Super excited to share this—I'm starting a weekly 1-hour live session on Spring AI! 🚀

AI is changing the game, and Spring AI is making it easier than ever to build intelligent applications. I’ve been diving deep into it, and I figured—why not share what I learn and help others get started too?

So, if you’re curious about AI, want to integrate it into your projects, or just love learning new tech, come join me!

📅 When? 🗓️ Every Saturday & Sunday ⏰ 10:30 AM - 11:30 AM IST

What’s in it for you? ✅ Hands-on coding & real-world use cases
✅ Breaking down AI concepts in a simple, no-jargon way
✅ Live Q&A—Ask me anything!
✅ A chance to connect with like-minded folks in tech

I want this to be fun, interactive, and valuable for everyone. If you’re in, drop a 🔥 in the comments or DM me! First session coming soon! Let’s build something awesome together. 💡💻

I am trying to improve my technical prowess by learning together. All the updates will be posted on my Linkedin. My linkedin id is - linkedin.com/in/anushkasri


r/SpringBoot • • Feb 24 '25

Question Free Hosting for a Spring Application?

24 Upvotes

Hello everyone,
I'm building a web application using Spring for the backend, and I want to deploy it. I was considering using Vercel, which offers free hosting and a free database, but unfortunately, Vercel doesn't support Spring—it only supports JavaScript.
Does anyone know of a free hosting and database service that supports Spring for deployment?


r/SpringBoot • • Jan 28 '25

Guide Integrating Spring AI with DeepSeek: A Step-by-Step Guide

Thumbnail
medium.com
24 Upvotes

r/SpringBoot • • Jan 06 '25

Laid Off and Looking: Remote Job Opportunities Needed

24 Upvotes

Hi everyone, I’m currently seeking a remote job and would greatly appreciate your recommendations or referrals. I have experience with Spring Boot, other programming languages, and tools like Kubernetes (kubectl). Unfortunately, I was laid off last September 2024, and despite my efforts on LinkedIn and other platforms, I haven’t been able to secure a new position.

To stay current with tech, I even started a YouTube channel, but my financial situation has become challenging, and I’ve exhausted my savings.

If you know of any opportunities or can connect me with someone hiring, please feel free to DM me. Your help means a lot. Thank you!


r/SpringBoot • • Dec 20 '24

Is maven compulsory to learn Java spring?

24 Upvotes

Newbie here, Have been learning core java for sometime and got familiar with it. Now I'm planning to learn spring boot. Do I need to learn Maven before Learning spring boot (idk what maven is). I have seen maven in lot of "prerequisites" list for learning spring.