r/SpringBoot • • Aug 16 '24

Roadmap for learning micro services with Springboot ?

Hi all,

I’m a React and Node.js developer looking to transition into microservices using Spring Boot. Could anyone suggest a roadmap or key resources to get started?

I'm especially interested in best practices, integration tips, and any recommended hands-on projects Thanks

29 Upvotes

24 comments sorted by

25

u/momsSpaghettiIsReady Aug 16 '24 edited Aug 16 '24

Biggest tips I can give:

Reduce synchronous http calls between services.

Favor async when you can. Need data from another service? Have the service that owns the data publish an event when it changes.

A microservice should never share a database with another service.

Test the crap out of your services with automated tests. It's hard to build on a brittle foundation.

Edit: a few more

Managing dependencies is hard. Look into gradle version catalogs so that all external dependency versions are in one spot and synced between apps.

Don't write your http clients by hand. Use springdoc openapi to autogenerate clients.

3

u/sans5z Aug 16 '24

Need data from another service? Have the service that owns the data publish an event when it changes.

How? I am learning microservices and I didn't understand your reference.

5

u/momsSpaghettiIsReady Aug 16 '24

Look into different forms of pub/sub or queueing.

A relatively beginner friendly way to do this in spring is with RabbitMQ(although the inner workings of AMQP can be quite complex). You can set it up using docker. There's tutorials on how to set up publishers and subscribers.

1

u/Sheldor5 Aug 16 '24

microservices never call each other, first mistake ...

1

u/[deleted] Aug 16 '24

Agree but all employers want microservices

4

u/JoeDogoe Aug 16 '24

I just joined a company where they only communicate between services by broadcasting on SNS then consuming from that on SQS for each service. You have to make three PRs and talk to two teams to change a field. It's trash DevX. Just version APIs.

1

u/Sheldor5 Aug 16 '24

sounds like fun

2

u/sans5z Aug 16 '24

How else should they share data? I haven't worked on microservices.

1

u/Sheldor5 Aug 16 '24

they don't share data

they should work independently

at max they "share" a resource IDs if they have to work on shared data

1

u/dns1211 Aug 18 '24

are you sure ?

0

u/[deleted] Aug 17 '24

They do, with rest template, rest client(new), web client etc

0

u/Sheldor5 Aug 17 '24

then that's not microservice architecture, that's just fucked up architecture

0

u/[deleted] Aug 17 '24

You’re noob then bro 😎

1

u/Sheldor5 Aug 17 '24

you don't even know the core principles of microservice architecture ... what a shame you are

7

u/[deleted] Aug 16 '24

There's two books that I think are good, but they are pretty lengthy, so they are more of a reference or a long course, than a quick start guide:

  • Microservice Patterns by Chris Richardson: this is more general but it is based on Java.

  • Cloud Native Spring in Action by Thomas Vitale: this one is based on Spring Boot and is fairly recent (2022) but bear in mind that new mayor versions of Spring and Spring Boot have come out since then.

3

u/JoeDogoe Aug 16 '24
  1. The original rules of microservices is Adam Wiggins 12 factor apps. https://12factor.net/

  2. Then Martin Fowler's Characteristics of Microservices https://martinfowler.com/articles/microservices.html

  3. Finally my personal favourite David Schmitz how to fail at microservices talk. https://youtu.be/r8mtXJh3hzM?si=ZdGXpJytT-WSllbB

For the first two I'm sure you'll find high quality YouTube videos of those concepts.

1

u/gnpwdr1 Aug 16 '24

Here's a nice roadmap site to help a bit more.

https://roadmap.sh/spring-boot

-4

u/Sheldor5 Aug 16 '24

simply don't do Microservice Architecture.

best advice I can give you.

7

u/momsSpaghettiIsReady Aug 16 '24

Find me an employer that doesn't do microservices first.

We'd all love to avoid it, but the reality is that this architecture is everywhere, whether it's the right choice or not.

0

u/Sheldor5 Aug 16 '24

all of my previous 5 and current employers

2

u/JoeDogoe Aug 16 '24

OP just say this in the interview. They'll respect and hire you right there.

1

u/MaterialAd4539 Aug 17 '24

Ok so what architectures should one learn after learning spring boot?