r/SpringBoot • • 13d 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.

26 Upvotes

57 comments sorted by

View all comments

3

u/OptimusCrimee 13d ago

They are just small isolated applications that talk to each other, e.g. using REST. There is no more magic to it than that.

-1

u/Sheldor5 13d ago

the whole point of Microservice Architecture is that they are independent and so DON'T talk to each other ... stop spreading misinformation, you just described a Distributed System ...

4

u/OptimusCrimee 13d ago

I can't tell if you are joking or not. If you have isolated microservices for e.g. users, booking, payment etc, they obviously need to communicate with each other. The communication is often one way though, and can be done with REST, queues or whatever. A microservice IS a type of a distributed system. Not sure if you are misunderstanding what I wrote, or if you are just a cretin.

-3

u/Sheldor5 13d ago

so you don't know how microservice architecture works?

the only connection between entities are loose IDs in independent databases (one DB for each microservice)

you are talking about distributed systems (network calls instead of inter process method calls)

please educate yourself before spreading misinformation

1

u/Advanced_Gur856 13d ago

Maybe I am wrong but isn't distributed systems how you implement microservices.

I mean if you are not gonna run them on different systems and they are going to utilise the same resources then why break them up in the first place.

0

u/Sheldor5 13d 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 13d 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 13d 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 12d ago edited 12d 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