
Understand microservices architecture as a collection of loosely coupled, independently deployable services that perform specific functions, communicate via a well-defined API, and enable modularity, flexibility, scalability, and diverse technologies.
Explore a microservices architecture with an API gateway, discovery and config servers, and two microservices (students and school) with dockerized databases, plus distributed tracing via Zipkin.
Set up a monorepo-based microservices project by creating an empty workspace in IntelliJ, opening the folder, and adding a readme to document the microservices sample project by alibux.
Create the API gateway, discovery server, and config server with microservices, configure Spring Cloud and Zipkin integration, and import the mono repo gateway into IntelliJ using module from existing source.
Create the discovery server microservice using Spring Boot 3.0 and Spring Cloud, configure Eureka Server, add config client with Spring Cloud Config, and include Actuator for metrics.
Create a config server using a maven project, naming the artifact config-server, apply the config server annotation to enable centralized configuration, then generate and import the project.
Configure the Eureka discovery server and the config server, enable the Eureka server, and show how microservices register with Eureka and appear on port 8761 and config on port 8888.
Create a new Spring Boot project for the student service, configure Maven, and add PostgreSQL, Lombok, Spring Data JPA, Spring Web, config client, discovery client, and Actuator.
Configure the student microservice with yaml-based Eureka discovery, spring properties for app name and config server import, and a PostgreSQL data source.
Explore building a student entity in a Spring Boot microservices setup, linking it to a school via a foreign key, and implementing it with Lombok, JPA annotations, and a repository.
Create a new interface named student repository that extends the JPA repository for the student type with an integer id to establish a working repository.
Create a student service with a repository-backed save and find all endpoints, using the service annotation and Lombok annotation, and connect a controller to expose student data.
Create a student controller with RestController and request mapping /api/v1/students, inject the student service via Lombok's required constructor using final keyword, and implement post and get mappings.
Create a school microservice by reusing the student interface and dependencies, rename to school, generate the project for download, and open it with the entity.
Refactor the student micro services to implement school functionalities by renaming components to school, updating application properties for the schools database, and enabling save and find all schools operations.
Run and test microservices by launching discovery, school, and student services, verify with Eureka config, expose through an api gateway, and build endpoints to fetch schools with their students.
Add a new get mapping endpoint in the school controller to find schools with students by passing the school id as a path variable.
Add a new endpoint in the student microservice that returns a full school response containing the school's name, email, and its students, via Lombok-annotated full school response and student classes.
Create a new endpoint in the student controller at /school to fetch all students by school id, delegating to a service method that uses repository.findAllBySchoolId, and finish inter-microservice communication.
Add the OpenFeign dependency to enable a declarative rest client between microservices by updating pom.xml and refreshing Maven project; OpenFeign generates an interface implementation annotated with JAX-RS or Spring MVC.
Implement an http client with Feign by creating a student client interface, configuring the student service url, and performing a get mapping to fetch students by school.
Restart and test microservices with Eureka, enable Feign client to fix a null pointer, then verify school and student communication and expose services through the API gateway.
Configure and run the api gateway by defining yaml properties, disabling eureka registration, enabling the discovery locator, and routing api/v1/students and api/v1/schools to their respective services.
Start all services—including discovery, school, student, and api gateway—and test with postman, create schools, and verify 201 responses, then externalize configuration with a config server to propagate changes.
Configure the config server for distributed configuration using yaml and set the native active profile. Enable the config server and point it to classpath:/configs so it fetches per-microservice configurations.
Externalize school microservice configuration using a config server by creating schools.yaml and trimming application.yaml to only app name and config import, then repeat for gateway, discovery, and students.
Externalize the student microservice configuration by creating a dedicated students.yaml, aligning the service name, and pruning the config to keep only the application name and config.
Externalize the gateway configuration by creating gateway.yaml in the config server and migrating discovery properties.
Externalize the discovery server configuration by creating a discovery.yaml and removing unused config, then start the application and verify it reads from the config server while remaining up.
Start the config server, run all microservices, and verify configurations; then insert sample data (schools and students) and fetch information from the backend.
Install and configure Zipkin to centralize distributed logs for our microservices. Use a Docker compose file to run Postgres and Zipkin, then access the interface at localhost:9411.
Add the Zipkin dependencies (bridge brave and reporter brave) to microservices, including gateway, school, and students, enable auto configuration, and set tracing sampling to 1.0 so traces reach Zipkin.
Run the config server and apps, then test requests with postman and verify traces in Zipkin, showing gateway routed calls to api v1 schools and centralized trace logs.
Discover the power of microservices architecture in this in-depth course, designed to provide you with a thorough understanding of building, deploying, and scaling modern applications. Through a blend of theory and practical examples, you'll explore essential concepts such as API Gateway, Config Server, Discovery Server, and hands-on implementation of two real-world microservices, Student and School.
Throughout this extensive course, you'll:
Understand the fundamentals of microservices architecture and its advantages over monolithic applications.
Implement an API Gateway to centralize and manage requests, providing a single entry point for your microservices ecosystem.
Utilize a Config Server to enable centralized configuration management, simplifying application maintenance and consistency across environments.
Leverage a Discovery Server for efficient service registration and discovery, ensuring seamless service-to-service communication.
Develop two practical microservices, Student and School, to understand the nuances of designing and building modular services.
Explore communication between microservices using OpenFeign, an easy-to-use, declarative REST client.
Enhance application observability and debugging with distributed tracing using Zipkin, allowing you to visualize and troubleshoot latency issues.
Learn best practices for securing, monitoring, and deploying microservices in production environments.
By the end of this comprehensive course, you'll have mastered essential microservices concepts, techniques, and tools, empowering you to create and deploy sophisticated, distributed applications with increased efficiency and confidence. Whether you're a developer, architect, or DevOps engineer, this course will equip you with the skills to successfully navigate and thrive in the world of microservices.