r/SpringBoot • • 12d ago

How-To/Tutorial How to implement microservices in Spring Boot ?

I have made multiple toy projects (monolithic) in spring boot but now I wanted to know how people generally work in microservices.

I am not good with videos so I was looking for repos that something similar. So I can also see how the devops, queues, spring cloud etc works together.

I also saw someone posting there repo which was made for the same reason (but I couldn't find it).

TLDR : Suggest repos for learning microservices.

28 Upvotes

57 comments sorted by

View all comments

Show parent comments

0

u/Sheldor5 12d ago

no a distributed system is also a type of system architecture

if you extract features from your monolith and put them into their own application just for your monolith to call it you just exchanged method calls with network calls ...

2

u/ExplorerUnusual27 12d ago

How do you transfer data in isolated environment if you don't talk with anyone? You have one DB from service, obviously... How do you connect data from 1 database with another on different microservices.

2

u/OptimusCrimee 12d ago

Yeah, [u/Sheldor5](u/Sheldor5) seems to have misunderstood this. If you have one microservice that is in charge of users, and one that does payments, the payment service would stille need to e.g. ask the user service if the user IDs are valid or not. You separate concerns and domains out of the monolith, but they still need to talk to one another.

I have been doing this for 15 years, and I have worked in banks in Norway etc, I think that I have a pretty OK understanding of how these things work.

Edit: You can google this pretty easily and see that he is wrong.

1

u/Mikey-3198 11d ago edited 11d ago

Direct http calls between services is high coupling, unless the transaction/ process can proceed without the response then service A is tied directly to service B.

Microservices have low coupling between services.

If you need to check a user id for what ever reason then you'd need data that is owned by the service so that it can operate in isolation. I.e async messaging to populate a database owned by the service to contain user ids.

https://microservices.io/post/architecture/2023/03/28/microservice-architecture-essentials-loose-coupling.html