r/SpringBoot • u/Character-Grocery873 • Apr 17 '26
Question Spring Modulith loose coupling
Hello to those who use Spring Modulith, I don't know what's the correct approach on my problem because AI suggested different approach and other docs/github discussions aswell. The problem is about read heavy queries, for example is Booking and Payment module, when making a Booking, if making a payment record then use events. But when i want to view my booking I want to show both my booking and payment info (status, payment method, etc) I thought of making a top-level dto on payment module and let Booking module call payment's public interface for info but then i also thought of possible circular dependency soon. What's your solution to this? It can be anything not just Booking/Payment example.
EDIT: A separate table(combining both) sounds like a good solution OR a join but in separate module, what are y'all thoughts?
View all comments
Show parent comment
2
u/spudtheimpaler Apr 17 '26
Sure, but that way lies dragons. If you have one API for every page load, you couple your page and API together and they become difficult to change. Making two calls will be quick, will happen in parallel, and has the right boundaries.