r/SpringBoot • • May 25 '25

Question Should i switch from nextjs to spring boot

28 Upvotes

Hi, my placements are starting from July. I am already experienced with NextJS and ML. But I was wondering whether I spend time learning Spring Boot or continue working with Next because I saw hell lot of jobs for Java Developers. I don't Java that much because of the complex syntax but I know it because it is required in my university.


r/SpringBoot • • May 22 '25

Question How to Learn Spring Boot Effectively with Free Resources? Looking for a Complete Roadmap

28 Upvotes

I'm a second-year engineering student currently working on building a web application. I want to develop solid, job-ready knowledge in Spring Boot using only free resources.

I already have experience in C, Python, and Java (intermediate level), and I'm comfortable with basic programming concepts and object-oriented principles.

Could anyone share a complete, structured roadmap to learn Spring Boot effectively—starting from the basics to the level required for job applications? Also, how long would it typically take to reach that level of proficiency if I dedicate consistent time daily?

Any free learning resources, tips, or project suggestions would be highly appreciated


r/SpringBoot • • May 16 '25

Guide Sharing my open source Spring Boot + React application

28 Upvotes

For the past 4 months, I have been working on this webapp that is essentially a lower-stakes LeetCode leaderboard to compete with your friends, as well as being able to easily view their code and such.

I saw someone else post their project in the hopes of helping others have access to modern codebases in Spring Boot, so I decided to share mine as well.

We have a small custom authentication layer via the Protector object that is built on top of Spring Security, a React frontend that consumes the Spring Boot API, a CI/CD pipeline to run our tests and deploy to DigitalOcean, and more.

We also did some cool stuff to get access to LeetCode's GraphQL layer, as well as a really hacky way to retrieve a token for queries that require some level of authentication, so feel free to check that out as well!

https://github.com/tahminator/codebloom


r/SpringBoot • • Apr 11 '25

Guide How To Solve The Dual Write Problem in Distributed Systems?

Thumbnail
levelup.gitconnected.com
28 Upvotes

Although the main purpose of the article is not about Spring Boot, I believe you guys would enjoy this read.

In a microservice architecture, services often need to update their database and communicate state changes to other services via events. This leads to the dual write problem: performing two separate writes (one to the database, one to the message broker) without atomic guarantees. If either operation fails, the system becomes inconsistent.

For example, imagine a payment service that processes a money transfer via a REST API. After saving the transaction to its database, it must emit a TransferCompleted event to notify the credit service to update a customer’s credit offer.

If the database write succeeds but the event publish fails (or vice versa), the two services fall out of sync. The payment service thinks the transfer occurred, but the credit service never updates the offer.

This article explores strategies to solve the dual write problem, including the Transactional Outbox, Event Sourcing, and Listening to Yourself.

For each solution, we’ll analyze how it works (with diagrams), its advantages, and disadvantages. There’s no one-size-fits-all answer — each approach involves consistency, complexity, and performance trade-offs.

By the end, you’ll understand how to choose the right solution for your system’s requirements.

I already preparing the next article implementing each pattern using the Spring Boot Ecosystem.


r/SpringBoot • • Apr 09 '25

Question Feeling lost while learning Spring Boot & preparing for a switch

28 Upvotes

Hi everyone,

I’m reaching out for some help and guidance. I have 2.5 years of experience in MNC. In my first 1.5 year, I worked with different technologies but mostly did basic SQL. Right now, I’m in a support project.

I want to switch companies, and I decided to focus on Java + Spring Boot. I’m still a newbie in Spring Boot. I understand Java fairly well, but with Spring Boot, I often feel like I’m not fully grasping the concepts deeply. I try to do hands-on practice and build small projects, but I’m not consistent, and it often feels like I’m just scratching the surface.

Another thing is, I don’t have a clear idea of how an enterprise-level project actually looks or how it’s developed in real-world teams — from architecture to deployment to the dev workflow. That part feels like a huge gap in my understanding.

If anyone has been in a similar situation or can share advice on how to approach learning Spring Boot (and real-world development in general), I’d really appreciate it. How did you stay consistent? What helped you go from beginner to confident?

Thanks in advance.


r/SpringBoot • • Dec 17 '24

Using the New RestClient in Spring 6

28 Upvotes

I recently started using the new RestClient API in Spring 6.1 to handle HTTP requests, and I found it very easy to use.

I used to rely on, which doesn't fit the same style of the WebClient. But using the WebClient doesn't make sense to me in the synchronous HTTP requests as it is just an overkill. It RestClient seems very clean and follows the same fluent API.

I wrote a quick guide on how to use it.

I made a practical example of using OpenAI ChatGPT completion using Rest Api.

What is your opinion on the new RestClient?


r/SpringBoot • • Oct 19 '24

Baeldung

28 Upvotes

Is baeldung free version enough to learn sprinboot. And does it cover all the topics in spring and springboot


r/SpringBoot • • Aug 21 '24

Want to deploy my first Spring Boot app with MySQL database. Need some guidelines

28 Upvotes

Hey folks. So me and a partner of mine built our first Spring Boot app. It's a farming management system with CRUD, authentication, and other features. We want to deploy it to the cloud. But we're not sure where to go from here.

Since this is just a hobby project, I want the initial cost to be minimal if not free. We don't have any plan to bring this to production. Just want to test it by hosting online.

I've done some quick internet searches. Some platforms, like Google Cloud, offer free trials. But it requires a Credit Card which none of us have, unfortunately (oof). Any other good alternative that has a free tier or trial? At least for a month? And perhaps easy to use?

Thanks a lot


r/SpringBoot • • Aug 20 '24

Study groups for java n springboot

28 Upvotes

Hey,

I am looking out for study groups for java and springboot so will be able to discuss and . Does anyone know such groups on whatsapp and/ or discord or any other platform.

Open to new interactions.


r/SpringBoot • • Jul 18 '24

140 Java Interview Questions Answers for 2 to 5 Years Experienced Programmers

Thumbnail
javarevisited.blogspot.com
28 Upvotes

r/SpringBoot • • Jun 17 '24

What are some good backend open source projects to learn from?

28 Upvotes

In my journey (as a beginner self taught dev with no work experience) I've found reading other people's code to be the best way for me to learn but I feel like my proficiency with backend tech have stagnated compared to frontend. I've learnt a lot from devs on here on what I should learn; system architecture & design, advanced databases, caching etc but I need to see how they are implemented


r/SpringBoot • • Dec 16 '22

Tutorial - Spring Boot Microservices 6 hours Course

28 Upvotes

Want to learn about Spring Boot Microservices this weekend? Have a look at this 6-hour course.

You will learn about:-

  • Developing Services using Spring Boot

  • Writing Tests using Test Containers

  • Implement InterService communication

  • Service Discovery using Eureka

  • API Gateway using Spring Cloud Gateway

  • Secure Services using Keycloak

  • Implement Circuit Breaker using Resilience4J

  • Implement Distributed Tracing using Spring Cloud Sleuth

  • Event-Driven Architecture using Kafka

  • Containerize the project using Docker

  • Monitoring Services using Prometheus and Grafana.

https://youtu.be/mPPhcU7oWDU


r/SpringBoot • • Aug 07 '26

How-To/Tutorial How to Fix the Hibernate N+1 Query Problem using JOIN FETCH in Spring Boot

27 Upvotes

I recently reproduced the Hibernate N+1 Query Problem in a Spring Boot application to better understand why a single repository call can generate multiple SQL queries behind the scenes.

The solution uses JPQL JOIN FETCH to fetch the required associations in a single query.

Core Query

Query(""" SELECT DISTINCT o FROM Order o JOIN FETCH o.items i JOIN FETCH i.product WHERE o.userId = :userId ORDER BY o.createdAt DESC """) 
List<Order> findAllWithItemsAndProducts(@Param("userId") Long userId);

Where the N+1 problem occurs

The repository is called only once, but while mapping the response, accessing lazy-loaded relationships can trigger additional SQL queries.

List<OrderResponse> response = orders.stream()
    .map(order -> {

        List<String> products = order.getItems().stream()
                .map(item -> item.getProduct().getName())
                .toList();

        return new OrderResponse(
                order.getId(),
                order.getTotalAmount(),
                products
        );
    })
    .toList();

Although this Java code looks perfectly normal, order.getItems() and item.getProduct() may cause Hibernate to execute additional queries when those relationships haven't been loaded yet.

Project Details

  • Spring Boot 4.0.4

  • Spring Data JPA

  • Hibernate ORM

  • Java 17

  • Oracle Database

What this implementation demonstrates

  • Retrieves Orders for a specific user

  • Demonstrates how LAZY loading can lead to the N+1 query problem

  • Uses spring.jpa.show-sql=true to inspect the SQL generated by Hibernate

  • Maps entities to a custom DTO containing Product names

  • Eliminates unnecessary queries using JPQL JOIN FETCH

  • Compares SQL queries and execution time before and after the optimization

One thing I found interesting is that there isn't anything obviously wrong with the Java code itself. The repository method is invoked only once, but navigating lazy-loaded relationships while building the response can result in multiple SQL queries behind the scenes.

Using JOIN FETCH allows Hibernate to load the required entity graph up front, avoiding those additional database round trips for this use case.

I'm curious how others handle this in production.

  • Do you prefer JOIN FETCH, @EntityGraph, or DTO projections?

  • Have you encountered pagination limitations with JOIN FETCH?

I'd love to hear your experiences.

If you'd like to see the complete Spring Boot application, the generated SQL before and after JOIN FETCH, and the full implementation, I also recorded a practical walkthrough covering the entire example.

📺 YouTube: https://www.youtube.com/watch?v=natXN7xVEu8


r/SpringBoot • • Jul 16 '26

Discussion Title: Anyone Learning Spring Boot?

27 Upvotes

I'm currently learning Spring Boot, JPA, MySQL, and building projects to strengthen my Java backend skills.

Looking for a study/accountability partner to learn together, discuss concepts, and stay consistent.

If you're on a similar path, let's connect!


r/SpringBoot • • May 07 '26

News How a Group of Developers Took Back Control from Enterprise Java | Spring: The Documentary

Thumbnail
youtu.be
27 Upvotes

r/SpringBoot • • Apr 28 '26

How-To/Tutorial Building a Price Aggregator in Java (Spring Boot, Redis, Resilience4j) — would love some feedback

27 Upvotes

I’ve been building a small project to understand how real backend systems evolve—from simple code to something closer to production.

Use case:
A Price Aggregator that calls multiple vendor services (Amazon/Flipkart/Walmart mock APIs) and returns the best price.

What I’ve implemented so far:

• Sequential vs async calls using CompletableFuture (measured latency differences)
• Spring Boot microservice with WebClient (non-blocking calls)
• Async processing using thread pools
• Caffeine cache → later replaced with Redis (for distributed caching)
• Docker + docker-compose setup
• Circuit Breaker using Resilience4j (to handle vendor failures)

Repo: https://github.com/codefarm0/price-aggregator
Playlist (if you want context): https://www.youtube.com/playlist?list=PLq3uEqRnr_2Ek7y2U3UAiQZCPzr0a82CX

What I’d really appreciate feedback on:

  1. Is the caching strategy reasonable? (Redis usage, TTL, etc.)

  2. WebClient + thread pool approach — anything you’d change?

  3. Circuit breaker config — too aggressive / too lenient?

  4. Overall design — anything that feels “toy-ish” vs production?

  5. What would you add next? (thinking retries, rate limiting, observability)

Trying to keep this as close to real-world as possible without overengineering.

Would genuinely appreciate any suggestions or critique

#java #springboot #microservices #scalability #resiliency


r/SpringBoot • • Mar 09 '26

Question Spring or SpringBoot

27 Upvotes

I have recently started learning SpringBoot and done a few basic concepts like controllers and restApis, should I continue the entire development in spring boot or switch to Spring after finishing the basics?


r/SpringBoot • • Dec 14 '25

Discussion Built a thread safe Spring Boot SSE library because Spring's SseEmitter is too barebones

27 Upvotes

I've been working with SSE in Spring Boot and kept rewriting the same boilerplate - thread-safe management, cleanup on disconnect, event replay for reconnections, etc. Spring actually gives you SseEmitter but nothing else.

This annoyance popped up in two of my projects so I decided to build Streamline, a Spring Boot starter that handles all of that without the reactive complexity.

The problem it solves:

Every SSE implementation ends up looking like this:

// Manual thread-safety, cleanup, dead connection tracking
private final Map<String, SseEmitter> emitters = new ConcurrentHashMap<>();
private final Lock lock = new ReentrantLock();

public void broadcast(Event event) {
    lock.lock();
    try {
        List<String> dead = new ArrayList<>();
        emitters.forEach((id, emitter) -> {
            try { emitter.send(event); } 
            catch (IOException e) { dead.add(id); }
        });
        dead.forEach(emitters::remove);
    } finally { lock.unlock(); }
}
// + event history, reconnection replay, shutdown hooks...

With Streamline:

private final SseRegistry<String, Event> registry; 

registry.broadcast(event);  
// That's it

What it does:

  • Thread safe stream management using virtual threads (Java 21+)

  • Automatic cleanup on disconnect/timeout/error

  • Allows for event replay for reconnecting clients

  • Bounded queues to handle slow clients

  • Registry per topic pattern (orders, notifications, etc.), depends on your use case

Quick example:

java

public class SseConfig {
    
    public SseRegistry<String, OrderEvent> ordersRegistry() {
        return SseRegistry.<String, OrderEvent>builder()
            .maxStreams(1000)
            .maxEvents(100)
            .build();
    }
}

GetMapping("/orders/stream")
public SseEmitter subscribe(@RequestParam String userId) {
    SseStream stream = ordersRegistry.createAndRegister(userId);
    return stream.getEmitter();
}

// Somwhere else
ordersRegistry.broadcast(orderEvent);

Design choices:

  • Blocking I/O + virtual threads (not reactive, use WebFlux if you need that)

  • Single instance only

  • Thread safe by default with clear failure modes

  • Comprehensive tests for concurrent scenarios

It's available on JitPack now. Still early (v1.0.0) and I'm looking for feedback, especially around edge cases I might have missed.

GitHub: https://github.com/kusoroadeolu/streamline-spring-boot-starter

Requirements: Java 21+, Spring Boot 3.x

Happy to answer questions or hear how it might break in your use case.


r/SpringBoot • • Nov 04 '25

Question How to learn Keycloak

27 Upvotes

I recently heard about the importance of keycloak and why it is important to use it for more strong and robust authentication and authorization instead of rewriting your own, so can anyone suggest a resource to learn from it how to use it with spring boot from the very basics.


r/SpringBoot • • Sep 01 '25

Question Clean Arquitecture with Springboot

27 Upvotes

Hello, I have a not small project (35 entities, idk if that is still small or what size it is) and have been using the following design for the project:
The flow is: Web -> Controller -> Service -> Repository .

It has worked quite well but the project is growing and some entities that are the "core" of the project have lots of functions and we started to divide the service into smaller, more dedicated services, like the app user example. But even then the services are starting to grow even more and my co worker started to look into alternatives. He found that the Clean Arquitecture model which uses use_cases would simplify the problems we have now. It uses "dependency inversion" or something similar and I wanted to know If you have used something similar or what you would do. The current problem is that the service returns dtos and the controller just returns what it received. That makes it so that if you want to re-use some function that already returns a dto you have to find the entity again. The "easy solution" would be to always return entities or list of entities and then map to the dto on the controller. My idea would be to create a mapper layer between the controller and service. But that still isnt what the Clean Arquitecture is.

Well... TLDR, have you implemented Clean Arquitecture on your project before? For example in Clean Arquitecture the entity is divided into two, a jpa entity that has the attributes and a class that implements de methods. Maybe I rambled to long idk.


r/SpringBoot • • Jul 22 '25

Question Not Learning Anything

27 Upvotes

I am working as Software Developer having tech stack Spring Boot but only thing I have learnt is to make api and some necessary annotation and there purpose. I think I am lagging behind what I see my friends do in another company. From where should I learn, not just spring also other backend development tech stack such that I will relevant in software development.


r/SpringBoot • • Jul 09 '25

Question Book recommendations for deepening Spring Boot knowledge?

27 Upvotes

Hey everyone!

I already know the basics of Spring Boot pretty well — I’ve built a solid e-commerce app using microservices, Spring Data JPA, Spring Cloud, and some Spring Security. So I’m not exactly a beginner.

But I’ve noticed it’s easy to do things in Spring Boot without actually having a deep understanding of how things work under the hood. That’s what I want to fix now.

My cousin is visiting from the US soon, so I figured it’s a good opportunity to order a few books that go deeper into Spring internals, best practices, and design patterns — the kind of stuff you don’t always get from tutorials or quick guides.

I’m already getting Spring Start Here, but I’d love your thoughts on:

  • Spring Boot in Action — is it still worth it in 2025?

  • Spring in Action

  • Cloud Native Spring in Action

  • Spring Security in Action — how deep does it go?

  • Any other books that helped really level up your Spring knowledge?

Appreciate any suggestions! Thanks 🙌


r/SpringBoot • • Nov 29 '24

How should I learn SpringBoot?

27 Upvotes

Hello everyone! I'm a third year cs student trying to get started learning springboot as I recently found out that i enjoy and love coding in java. I already know the basics of node js, react js, DBs, etc.

Every SpringBoot course I see is huge with several hours of content, most of which is I think wouldn't be much of an use to a student getting started. My doubts today is:

  1. How much of java do i need to know to get started with SpringBoot?(I already know the basics and OOP)

  2. What concepts of SpringBoot do I need to grasp in order to start making beginner projects as a student?

Thank You...


r/SpringBoot • • Oct 19 '24

is spring security enough to have a fully secured system (auth, endpoints...) ?

27 Upvotes

Well I'm building a RESTful API for my project, I'm about to set up security for auth and my endpoints, so my question is can we have a fully secured system only by spring security without the need of any 3rd party tools like JWT or oauth2...