Lesson 1 – Introduction to Spring Boot and Microservices

Objectives

  • Understand Spring Boot
  • Understand microservices
  • Relationships between Spring boot and Microservices
  • Set up Spring Boot

1. What is Spring boot?

Spring boot is a framework which is designed to simplify the development of stand-alone , productions-grade applications.

Key Features:

  • Auto-configuration: It simplifies setup based on the classpath and other settings
  • Embedded Servers: Spring boot comes with Tomcat, Jetty or undertow embedded servers.
  • Production-ready: Spring is production grade framework. It has features like metrics, health checks and externalized configuration.

2. What is Microservice?

Microservices is a collection of small, autonomous services model around a business domain.

Key Characteristics:

  • Independence: Each server is independent to develop, deploy and scale
  • Loose Coupling: Services are loosely coupled and communicate over a network
  • Resilience: Each service handle failure itself that’s why it does not compromise the entire application.

3. Why Spring Boot for Microservices?

Spring Boot’s simplicity and extensibility make it an excellent fit for microservices. Its embedded server support, easy integration with Spring ecosystem, and production-ready capabilities ensure a smooth path from development to deployment.

4. Set Up Spring Boot

Step1: Install JDK (Java Development Kit) Ensure you have Java Development Kit (JDK) installed. Spring Boot requires JDK 8 or higher. Which JDK you should use it is mainly depends on which Spring boot version you are using. For example if you use Spring boot 3.2 or higher, you need JDK 17.

Step2: Install an IDE Spring Boot works well with IntelliJ IDEA, Eclipse, or STS (Spring Tool Suite).

Step 3: Create a Spring Boot Project

  1. Go to Spring Initializr
  2. Choose Maven or Groovy or Kotlin
  3. Select Java and enter details – Group, Artifact, Name, Description, Package Name.
  4. Add dependencies
  5. Click on Generate to download the project archive.
  6. Unzip and import this project into your IDE.