Spring Boot – 100+ Lab Exercises (Basic, Intermediate, Advanced)

🔰 Basic Level (30+ Exercises)

 

Goal: Learn the fundamentals of Spring Boot development and RESTful API creation.

 

Getting Started with Spring Boot

  • Setup Spring Boot project using Spring Initializr

  • Create a simple RESTful “Hello World” API

  • Understand Spring Boot application structure

  • Run Spring Boot app using embedded Tomcat

  • Build and run Spring Boot jar

Spring Boot Fundamentals

  • Create Controller and handle HTTP GET requests

  • Handle POST requests with @RequestBody

  • Path variables and query parameters

  • Exception handling with @ControllerAdvice

  • Custom error response structure

Dependency Injection & Beans

  • Create and inject Beans using @Component and @Autowired

  • Bean lifecycle with @PostConstruct and @PreDestroy

  • Configuration properties with @Value

  • Use @Configuration and @Bean annotations

  • Profiles and environment-specific properties

Data Access with Spring Data JPA

  • Setup H2 in-memory database

  • Define Entity classes

  • Create Repository interfaces

  • Basic CRUD operations

  • Custom queries with @Query


 

🚀 Intermediate Level (40+ Exercises)

 

Goal: Master real-world REST APIs, Spring Security, and business logic architecture.

 

REST API Advanced Concepts

  • Pagination and Sorting with Pageable

  • Filtering data via query params

  • Implement PATCH requests

  • Use DTOs with ModelMapper

  • Implement validation with @Valid and @NotNull

Security with Spring Security

  • Basic authentication setup

  • Role-based authorization

  • JWT token generation and validation

  • Securing REST APIs

  • Password encoding with BCrypt

Service Layer and Business Logic

  • Create Service classes with @Service

  • Transaction management with @Transactional

  • Asynchronous services with @Async

  • Implement caching with Spring Cache

  • Use AOP for logging

Database and Persistence

  • Migrate from H2 to MySQL/PostgreSQL

  • Relationships (@OneToMany, @ManyToOne)

  • Cascade types and Fetch types

  • Auditing with @CreatedDate and @LastModifiedDate

  • Database migrations with Flyway

File Upload & Download

  • Upload files with Multipart

  • Serve files via REST API

  • Store files in DB vs filesystem

  • Implement file size limits

  • Validate file types


 

🧠 Advanced Level (30+ Exercises)

 

Goal: Engineer scalable microservices and deploy them to cloud infrastructure.

 

Microservices Architecture

  • Create multiple Spring Boot microservices

  • Service registration with Eureka

  • Client-side load balancing with Ribbon

  • API Gateway with Spring Cloud Gateway

  • Distributed tracing with Sleuth and Zipkin

Messaging & Integration

  • Async communication with RabbitMQ

  • Kafka integration

  • REST API integration using WebClient

  • Scheduled tasks with @Scheduled

  • Event-driven programming with ApplicationEvents

Monitoring & Health Checks

  • Actuator endpoints setup

  • Custom health indicators

  • Metrics and Prometheus integration

  • Log aggregation with ELK stack

  • Centralized configuration with Spring Cloud Config

Testing & CI/CD

  • Unit testing with JUnit 5

  • Mocking with Mockito

  • Integration testing with @SpringBootTest

  • Testcontainers for DB testing

  • Setup CI/CD pipeline for Spring Boot app

Cloud Deployment & Scaling

  • Dockerize Spring Boot app

  • Deploy to Kubernetes cluster

  • Auto-scaling with Kubernetes HPA

  • Deploy on AWS Elastic Beanstalk

  • Use AWS RDS for DB


 

🚀 Capstone Projects & Use Cases

 

  • Build E-Commerce REST API with user roles and payment simulation

  • Employee Management System with audit logs

  • Social Media Feed microservice architecture

  • Real-time chat service with WebSocket

  • IoT data ingestion backend


 

Tools & Ecosystem

 

  • IDE: IntelliJ IDEA / Eclipse

  • Build Tools: Maven / Gradle

  • Database: H2, MySQL, PostgreSQL

  • Cloud: AWS / Azure / GCP (optional)

  • DevOps: Docker, Kubernetes, Jenkins, GitHub Actions

Scroll to Top