Spring Boot and Microservices Roadmap for Beginners

In this article, let's take a look at the roadmap to learn Spring Boot and Microservices. This roadmap is for beginners who want to learn to build Restful web services and microservices using Spring Boot.

Check out my top Udemy course: Building Microservices with Spring Boot and Spring Cloud

Note: This Roadmap is my personal opinion as per my experience on Spring Boot and Microservices but there could be other opinions by different developers.

Spring Boot is a very popular Java framework for building Restful web services and microservices.

Nowadays MicroServices is the hot buzzword in software development and many organizations prefer building their enterprise applications using MicroServices architecture. In the Java community, SpringBoot is the most widely used framework for building both monoliths and microservices.

YouTube Video

Spring Boot and Microservices Roadmap

1. Learn Spring Core

I have seen many times that people (especially beginners) directly jump on to SpringBoot without having any prior Spring knowledge and everything looks magical. It works great as long as go with the defaults and the moment you need to customize it, it feels complex. So I highly recommend that before learning Spring Boot directly, you can learn Spring core fundamentals such as:
  • Dependency injection
  • Spring IOC
  • Spring AOP
  • Spring beans
  • Spring bean life cycle
  • Spring configuration styles (XML, Java-based, and annotation-based) 
  • Learn important annotations
By learning Spring core, you will be able to understand how to use DI, IOC, Spring beans in Spring-based applications.

2. Learn Spring Boot

Learn Spring Boot features

Next, start learning Spring Boot. You can begin with learning Spring boot features such as:
  1. Spring Boot starters
  2. Spring Boot autoconfiguration
  3. Elegant configuration management
  4. Spring Boot Actuator
  5. Easy-to-use embedded servlet container support

2.2 Learn Building REST APIs

Learn how to build REST APIs using Spring boot:
  • GET
  • POST
  • PUT
  • DELETE
Check out my free course to learn to build REST APIs using Spring Boot at Spring Boot Restful Web Services Tutorial | Full Course

2.3 Repository/DAO Layer

Next, learn how to build a repository/DAO layer in the spring boot application.


The goal of the Spring Data module is to significantly reduce the amount of boilerplate code required to implement data access layers for various persistence stores.

Spring Data provides different modules to work on different persistence stores:
  • For JPA - Spring Data JPA
  • For JDBC - Spring Data JDBC
  • For MongoDB - Spring Data MongoDB
By learning Spring Data JPA, you will be able to develop a repository/DAO layer without writing boilerplate code.

2.4 Spring MVC Web Application

To develop a Spring MVC web application, you need to Spring MVC and how Spring MVC works internally.

To develop a view layer in the Spring MVC web application, I am going to suggest you use the Thymeleaf template. You can also use JSP but JSP is something line outdated and nowadays developers use Thymeleaf to develop a view layer in the Spring MVC web application.

To learn Thymeleaf, check out my Thymeleaf crash course.
Spring Security is a framework that provides authentication, authorization, and protection against common attacks. 

Spring security is a de facto standard for securing web applications and Restful web services in Java.

Also, learn JWT for token-based authentication to secure REST APIs.

By Learning Spring security, you will be able to secure web applications as well as REST APIs.

2.6 Testing Spring Boot Application

Learn the JUnit framework and Mokito for unit testing in Java. As a Java programmer, you should have good knowledge of testing your core logic using the JUnit framework.

Spring boot provides @SpringBootTest and @DataJpaTest annotations to test controllers and repositories.

To learn and master the JUnit framework at JUnit tutorials

Check out my popular Udemy course to learn Spring boot application testing.

3. Databases

As a Java programmer, you should have good knowledge of databases.

Here are the commonly used relational databases and No SQL databases:

3.1 RDBMS:

  • MySQL
  • PostgreSQL
  • MS-SQL server
  • Oracle

3.2 No SQL Databases:

  • MongoDB
  • Cassandra

4. Microservices


Spring Boot and Spring Cloud are a great combination to develop Microservices in the Java community.
 
Spring Boot is the most popular and widely used Java framework for building MicroServices. Spring Boot makes it easy to create standalone, production-grade Spring-based Applications that you can “just run.”

Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state).

4.1 Spring Cloud Modules

Following are just a few of the Spring Cloud modules that can be used to address distributed application concerns:

Spring Cloud Zuul Proxy: 

Spring Cloud provides a Zuul proxy, similar to Nginx, that can be used to create API Gateway.

API Gateway, aka Edge Service, provides a unified interface for a set of microservices so that clients do not need to know about all the details of microservices internals.

Spring Cloud Config Server: 

To externalize the configuration of applications in a central config server with the ability to update the configuration values without requiring to restart of the applications. We can use Spring Cloud Config Server with git or Consul or ZooKeeper as a config repository.

Service Registry and Discovery: 

As there could be many services and we need the ability to scale up or down dynamically, we need Service Registry and Discovery mechanism so that service-to-service communication should not depend on hard-coded hostnames and port numbers. Spring Cloud provides Netflix Eureka-based Service Registry and Discovery support with just minimal configuration. We can also use Consul or ZooKeeper for Service Registry and Discovery. 

Circuit Breaker: 

In microservices-based architecture, one service might depend on another service and if one service goes down then failures may cascade to other services as well. Spring Cloud provides Netflix Hystrix-based Circuit Breaker to handle these kinds of issues. 

Spring Cloud Data Streams: 

These days we may need to work with huge volumes of data streams using Kafka or Spark etc. Spring Cloud Data Streams provides higher-level abstractions to use those frameworks in an easier manner.

Spring Cloud Security: 

Some of the microservices need to be accessible to authenticated users only and most likely we might want a Single Sign-On feature to propagate the authentication context across services. Spring Cloud Security provides authentication services using OAuth2.

Distributed Tracing: 

One of the pain-point with microservices is the ability to debug issues. One simple end-user action might trigger a chain of microservice calls, there should be a mechanism to trace the related call chains. We can use Spring Cloud Sleuth with Zipkin to trace the cross-service invocations. 

These are just a few of Spring Cloud's features. To explore more visit https://projects.spring.io/spring-cloud/.

4.2 MQ (Message Queues) - RabbitMQ or Apache Kafka

Spring Cloud Stream is a framework built on top of Spring Boot and Spring Integration that helps in creating event-driven or message-driven microservices.

Communication between endpoints is driven by messaging-middleware parties like RabbitMQ or Apache Kafka. Services communicate by publishing domain events via these endpoints or channels.

RabbitMQ and Apache Kafka are common messaging brokers that microservices can use to communicate by publishing domain events via these endpoints or channels.

4.3 DevOps

Docker and Kubernetes

Docker helps to “create” containers, and Kubernetes allows you to “manage” them at runtime. Use Docker for packaging and shipping the app. Employ Kubernetes to deploy and scale your app. 

Startups or small companies with fewer containers usually can manage them without having to use Kubernetes, but as the companies grow, their infrastructure needs will rise; hence, the number of containers will increase, which can be difficult to manage. This is where Kubernetes comes into play.

Clouds

  • AWS
  • GCP
  • Azure

References (Credits)


Comments