Should I Use Reactive Hibernate with JPA or R2DBC for Spring Boot?
Asked by
WanderingCoder42
I'm developing a modular monolith using Spring Boot and am considering making it reactive, especially since I've been working with Quarkus and reactive PostgreSQL. I've come across R2DBC in Spring, which seems to require SQL, so I'm reaching out for expert advice. I'm also noticing that many job listings favor Spring Boot skills, so I'm curiousโdo most companies really use reactive Spring Boot these days?
Answers
The reactive API can get messyโit often leads to that callback hell everyone dreads. Virtual threads could save the day here, allowing you to write cleaner, more straightforward concurrent code. Just make sure you verify that your PostgreSQL driver can handle multithreading properly.
Reply to this answer
You're right to look into Spring WebFlux for reactive apps. Just keep in mind that youโll want a reactive database connection to really leverage its benefits. That's essential for smooth performance.
Reply to this answer
Honestly, most companies aren't diving into reactive stuff. Many find the overhead isn't worth it. An interesting alternative is using virtual threads with Java 21 to 25, which can offer efficient concurrency without the complexities of reactive programming.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions