
Welcome to the Spring Boot Microservices course!
Learn about the applications you will build in your Spring Boot Microservices course.
In this lecture you will get tips and advice on how to get the most out of your Spring Boot Microservices with Spring Cloud course.
In this lecture you will learn about setting up your development environment for your Spring Boot Microservices with Spring Cloud course.
Join the Slack Group for the Spring Boot Microserviecs course!
In your Spring Boot Microservices with Spring Cloud course, you will see the IntelliJ Ultimate IDE used. (This IDE is not required to complete the course)
Students enrolling in Spring Boot Microservices with Spring Cloud, can register to get a free 120 trial of IntelliJ IDEA Ultimate.
Learn a GitHub workflow for the Spring Boot microservices with Spring Cloud course: fork, clone, and compare repositories, use lesson branches, and track changes across remotes.
Preview of the section of the course Introducing Microservices, and road map overview of upcoming sections.
Learn about traditional monolithic applications
Learn what microservices actually are and how microservices are different from traditional monolithic applications
When companies start using microservices, there are challenges they will face in the transition from traditional monoliths to microservices.
Microservices at a higher level are a design pattern.
Explore REST services, the HTTP protocol, and the role of RESTful communication in microservices, then preview building and consuming REST services with Spring MVC in this course.
Explore HTTP request methods and status codes, learning verbs like GET, POST, PUT, DELETE, and understanding safe, idempotent behavior across 200, 300, 400, and 500 series responses.
Explore RESTful services basics, including common HTTP verbs, URI concepts, and idempotence, and learn how statelessness, HATEOAS, and JSON representations guide resource interactions.
Learn the Richardson maturity model for REST, from the swamp of POX to level 3 with hypermedia controls, noting that most RESTful APIs conform to level 2.
Conclude the course segment on restful web services by contrasting REST and SOAP, highlighting the lack of a formal REST standard and the need to adapt when integrating third-party services.
Build RESTful endpoints on the server side using Spring MVC with Spring Boot. Explore REST terminology, producer side methods, and how Spring Framework enables client-server communication.
Introducing the SFG Beer Works microservices demo, a beer distribution supply chain built with Spring Boot and Spring Cloud, featuring four services: Beer Consumer, Pub, Distributor, and Breweries.
Learn to create a spring mvc rest get endpoint that returns a beer dto via a dedicated beer service and controller, in a spring boot 2.1.4 project.
Implement a Spring MVC post endpoint to create a new BeerDto, save it via the BeerService, and return a 201 created response with a Location header.
Spring Boot has a set of developer tools to help you with you code. In this lecture learn how Spring Boot Developer tools can help with your development activities.
implement put mapping in spring mvc to update an existing beer via its id and a beer dto, then return a 204 no-content response indicating a successful, idempotent update.
Learn how the @RequestBody annotation binds JSON to a beerDto in Spring MVC, and why omitting it yields an empty object, with MockMvc, JUnit 4, Mockito, and ObjectMapper tests.
Implement a Spring MVC delete endpoint for beer, binding beerId as UUID with @DeleteMapping and @PathVariable, log with Lombok @Slf4j, call beerService.deleteById, and return 204 no content via @ResponseStatus.
Learn how API versioning lets you evolve microservices without breaking existing clients, using semantic versioning (major, minor, patch), deprecation, and URL-based versioning.
Learn how to implement a major api version change within a spring boot microservice by evolving beer model from string to enum, creating v2 packages and controllers, and routing api/v2/beer.
Learn how to manage api versioning with source control using feature and release branches, track breaking and non-breaking changes, and maintain multiple api versions across microservices.
In this lecture you will learn how to create a new Spring Boot project using the Spring Initializer.
Develop the beer service data model by creating BeerDto with id, version, createdDate, lastModifiedDate, beerName, beerStyle, upc, quantityOnHand, and price, using Lombok builders. Add a BeerPageList for paging.
Spring Boot 2.1 uses JUnit 4. In Spring Boot 2.2, the Spring team moves to JUnit 5, which is used throughout the course.
In this section you will learn about how Spring Boot automatically configures Spring's RestTemplate.
Explore how to use Spring RestTemplate to call RESTful services, configure an externalized api host with configuration properties via Spring Boot and RestTemplateBuilder, and test with integration tests.
Learn to post a new beer with Spring RestTemplate by implementing saveNewBeer that returns the location URI via postForLocation, and verify the flow with integration tests using the BreweryClient.
Practice test-driven development by live-coding a customer service client with four CRUD operations (get, save, update, delete) using restTemplate and getForObject, validating tests turn green for github submission.
Explore HTTP clients for REST in Java, covering TCP/IP, sockets, blocking vs non-blocking I/O, connection pooling, and HTTP/2 support with popular clients like Apache, Jersey, OkHTTP, and Netty.
Configure Spring Boot to use the Apache HttpClient via RestTemplateCustomizer, set up a pooling connection manager with timeouts, and inject a ClosableHttpClient into a ClientHttpRequestFactory for efficient rest calls.
Configure Apache HttpClient request logging at debug level in Spring Boot to see headers, url, and wire data for troubleshooting, while noting performance costs and sensitive data risks.
Implement a bootstrap data loader that runs on startup to seed beer objects via a command line runner, using a beer repository with Spring Data JPA for testing and development.
Master the restful client basics and its versatile role for consuming a restful application programming interface in the Spring Framework, highlighting its methods and overloading as a foundational tool.
Transition into Spring validation, introducing bean validation and validation constraints for data entering controller methods, replacing hand-rolled validation with a consistent Java ecosystem approach.
Enable bean validation in Spring Boot by adding the starter validation dependency, apply javax validation constraints on the dto, and trigger validation with @Valid to produce a 400 on errors.
Learn bean validation error handling in spring boot microservices by returning a structured list of constraint violation messages from a v2 controller via a custom exception handler and response entity.
Spring Boot has several validation features not found in Spring MVC. Learn about Spring Boot's method validation in this lecture.
Enforce not blank and size 3 to 100 on the customer name with bean validation, using @Valid and @RequestBody in REST post and put methods, and return detailed validation errors.
Use controller advice to create a global exception handler, eliminating duplicate code across controllers, handle bind exceptions via BindException, and return a detailed error list as JSON with ResponseEntity.
Implement bean validation in the beer microservice by annotating BeerDto with @NotBlank, @NotNull, and @Positive. Enforce null on read-only fields like beerId, version, createdDate, and lastModifiedDate to prevent binding.
Apply bean validation with annotations and custom constraints in production-grade Spring Boot microservices, and craft clear error messages that align with API documentation for robust defensive coding.
Discover project Lombok's annotation processing that generates boilerplate code, including getters, setters, toString, EqualsAndHashCode, and constructors, plus builder support and lazy getters.
Explore MapStruct, a code generator and annotation processor that maps between Java bean types, follows convention over configuration, and supports custom mappings, Spring components, and Lombok builder integration.
Learn to configure MapStruct with Lombok in a Spring Boot project, including adding MapStruct and Maven compiler plugin settings and annotation processing paths, and handling version-specific Lombok MapStruct binding.
Explore building a two-way mapper with MapStruct by converting between Beer domain entities and BeerDto objects, generating a mapper implementation and ensuring simple, error-free persistence model transfers.
Build a MapStruct mapper that converts between Customer and CustomerDTO, using a @Mapper interface and a Lombok domain class, then compile and inspect the generated code.
Set up MapStruct to map between CustomerDTO and a domain Customer, implementing a mapper interface with two methods for dto-to-domain and domain-to-dto conversion, using Lombok and Spring components.
Discover how MapStruct handles date conversions between OffsetDateTime and SQL timestamp using a Spring component date mapper, enabling seamless mapping for BeerDto and domain classes.
Fix failing tests by adding a getValidBeerDto helper, set required properties (enable, price, upc) and not-null constraints, refactor tests, rerun to green, and commit the delta to GitHub.
Explore how Project Lombok and MapStruct save time by automating the builder pattern and logging configuration. This introduction to MapStruct highlights capabilities and sets up complex examples for Java development.
Review the beer service project for Spring REST Docs, covering Java 11, Spring Boot 2.1.5, JPA with H2, Lombok, and MapStruct.
Configure maven to support spring rest docs by adding the rest docs dependency and asciidoctor plugin, create asciidoctor directory with index.adoc, and generate snippets into an html document during prepare-package.
Configure spring rest docs to document a path parameter for the getBeerById endpoint, using pathParameters and parameterWithName to describe beerId as a UUID.
Document the getBeerId response by adding responseFields with fieldWithPath, ensuring all returned properties are documented for REST Docs.
Customize uri properties in Spring REST Docs for Spring Boot microservices, using AutoConfigureRestDocs to set uriScheme, host, and port, and regenerate documentation against a development server.
Generate and validate spring rest documentation by configuring maven and asciidoctor to produce generated-snippets and generated-docs. Fix identifier uniqueness for operations like v1/beer-new to ensure complete, error-free documentation.
Reviewing the Spring REST Docs integration: switch to JUnit 5, add Spring REST Docs and Asciidoctor, configure MockMvc, document beer endpoints and constraints, and generate accessible docs.
Explore the capabilities of Spring REST Docs for accurate API documentation, its unit-test integration, and Asciidoctor customization, and compare it with OpenAPI as another robust option.
Learn how Spring Boot handles JSON serialization and deserialization, converting Java objects to JSON and back, with auto configuration for Jackson, Gson, and JSON-B.
Set up a Spring Boot json test with @JsonTest and an ObjectMapper to serialize a BeerDto to json and deserialize it back, using Jackson as the binding engine.
Configure Jackson to use kebab naming strategy by creating application-kebab.properties, run @JsonTest with the kebab profile, and verify beer-name and beer-style JSON fields across camel, snake, and kebab conventions.
Create a custom local date deserializer with Jackson by extending StdDeserializer, implement deserialize to parse using a BASIC_ISO_DATE formatter, annotate the POJO, and update tests and JSON accordingly.
Apply Jackson configuration to the BeerDto with json format annotations for price and dates. Ensure price is serialized as a string and createdDate and lastModifiedDate are properly formatted.
Implement controller methods for the beer service, wire a BeerService via constructor, map between Beer and BeerDto, and throw NotFoundException via orElseThrow.
Conclude the module on processing JSON with Jackson, highlighting production and consumption of JSON, Jackson’s popularity surpassing Guava, and the importance of keeping libraries current for security.
Explore moving from monolith to microservices using a brewery application model, and learn architectural decisions, dependency management, and deployment considerations.
Deconstruct the Beer Works monolith into microservices using Spring Boot and Spring Framework, modeling beers, inventory, orders, and customers with event-driven messaging and tasting room demand.
Deconstruct a monolith into microservices using domain driven design and bounded contexts, outlining entities, value objects, domain events, aggregates, and repositories within a ubiquitous language.
Explore plans to deconstruct a monolith into bounded contexts with BeerOrderService, beers, and BeerInventoryService, defining aggregates and life cycle as we split into true microservices.
Review the beer-order-service code, detailing the domain setup (BeerOrder, BeerOrderLine, Customer, OrderStatusEnum), UPC-based data seeding, and cross-service coordination.
Review the beer inventory microservice code, exploring the BeerInventory entity, repository, dto mapping with Mapstruct, and a simple controller, while setting up ci pipelines and seed data for integration.
Review and implement the showInventoryOnHand query parameter across list beers and get beer by id endpoints, updating BeerController, BeerService, and BeerMapper to optionally include inventory data for API consumers.
Cache beer data with Ehcache in a Spring Boot app, configuring beerCache and beerListCache, and apply conditional caching when inventory is off to boost get and list beer performance.
Implement a new get beer by upc endpoint at /v1/beerUpc, wiring it through beerController, beerService, and beerRepository with a findByUpc method and enabling caching via beerUpcCache.
Enhance the order response by fetching beer data from the beer service and updating order lines with beer name and style using a rest template call and a custom mapper.
Deconstruct the monolith into three microservices with independent databases, enable inter-service communication, and implement a Maven BOM, JMS messaging, and saga coordination.
Building on the monolith-to-microservices transition, this lecture highlights progress, notes upcoming steps, and frames the challenges of splitting a single application into individual microservices and databases.
Microservices are all the buzz in the industry right now.
Building a microservice is not just a matter of using RESTFul APIs.
Microservices are much MUCH more than that.
In this course you will learn that Microservices are an architectural style. The allow companies to achieve massive scale while maintaining a high degree of flexibility.
This course goes beyond simple RESTful APIs and explores microservices as an architectural style.
** What Students are Saying about the Course **
5 STARS Great course, you can be sure about it. If you're fairly new to the java world and spring framework, I highly suggest to follow Spring Framework from beginner to guru (the teacher is always John). In my experience I can tell you that after the first course, I managed to progress in my career twice, with praises of my colleagues and managers. The content of both courses is very well explained and easy to learn. If you want to stand out, definitely this course worth the money.
5 STARS Very good course on microservices with Spring! It gave me a good starting point for the upcoming task at my work! 5* all the way for John!
5 STARS I like this course a lot! It's exactly what I needed after some experience with Spring Boot, to go to the next level. A lot of applications are presented, giving the opportunity to exercise what you've learned. The assignments are also very welcomed.
5 STARS Very VERY good content, well structured approach and clear explanations. Very enjoyable and educative. I'm even picking up a few techniques / frameworks I hadn't really used before.
About the Course
Traditionally, large enterprise class applications were developed as large monolithic applications.
The Spring Framework started as an alternative to J2EE (now JEE) for building these large monolithic enterprise applications.
As the industry evolved to favor microservices over monoliths, the Spring Framework and Spring Boot evolved also.
The Spring Framework gives you a battle-tested enterprise grade framework for building applications.
Spring Boot and Spring Cloud are tools specifically for the development of microservices using the Spring Framework.
Microservices present a unique set of challenges over monoliths. Spring Boot and Spring Cloud help you overcome these changes.
What are these challenges that microservices have, which traditional monoliths do not?
Is it okay for microservices to share databases?
How do you coordinate business logic across a series of microservices?
How do you manage transactions across serval microservices with different databases?
To explain these questions, in this course you get to explore a traditional Spring Boot monolith type of application. (Along the style of Spring Pet Clinic).
We will then re-create this monolithic application using a set of microservices.
You get to see, step by step how to build 3 different microservices.
Microservices are much more than just having a set of RESTFul APIs. Microservices frequently use asynchronous messaging systems, which is fully covered.
While the Spring Framework and Spring Boot are the tools you use to construct Microservices, Spring Cloud provides the tools to deploy microservices.
You get to see the latest tools in Spring Cloud for deploying Spring Boot Microservices into a distributed (or cloud) environment.
In 2018, Netflix announced several core projects to Spring Cloud were entering maintenance mode. Meaning no new development would be done on these projects.
Thus, in December of 2018, the Spring Cloud Team recommended several key replacements:
Previous Replacement
Hystrix --> Resliience4J
Ribbon --> Spring Cloud Load Balancer
Zuul 1 --> Spring Cloud Gateway
Archaius 1 --> Spring Cloud Config
Therefore, the recommend replacements are covered in this course.
Covered in this Course
In this course you will learn:
Develop RESTful Services using Spring MVC
Consume RESTFul Services with Spring RestTemplate
How to use Project Lombok
How to use MapStruct
Spring Data JPA with Hibernate
Configuration of Spring Boot for MySQL and H2
How to use and configure Jackson for processing JSON with Spring Boot
Data validation with Spring Boot and Hibernate Validator
Documentation and testing of Spring Boot microservices using Spring RESTdocs
Standardizing dependencies using Apache Maven
Spring Application Events
Using JMS Messaging using Apache ActiveMQ Artemis
The microservice Saga Pattern
How to use Spring State Machine for coordinating Sagas
Integration Testing using Spring Boot and JUnit 5
Using WireMock with JUnit 5
How to use Awaitily in your Integration Tests
The API Gateway pattern using Spring Cloud Gateway
Load Balanced Routes using Netflix Ribbon / Spring Cloud Loadbalancer
Service Registration using Netflix Eureka
Service Discovery with Netflix Eureka
Service Discovery using Spring Cloud OpenFeign
Circuit Breaker Pattern using Reslience4J and Hystrix / Spring Cloud OpenFeign
Manage configuration with Spring Cloud Config
Distributed tracing with Spring Cloud Sleuth and Zipkin
Securing Spring Cloud with Spring Security
Use Docker to create images for your Spring Boot applications
Push your Docker Images to Docker Hub
Configure Logback with Logstash for JSON logging output
Using Docker Compose to start and stop your microservices
Use ELK stack (Elasticsearch, Logstash, Kibana) for consolidated Logging
Provision virtual machines in the cloud for Eureka, Apache ActiveMQ Artemis, Spring Cloud Config, Zipkin, Elasticsearch, and Kibana.
Provision MySQL databases using Digital Ocean.
Create Docker Droplets (aka Virtual Machines) in Digital Ocean
Deploy Spring Cloud Config in the the cloud with Eureka
Create a Docker Swarm Cluster for Spring Boot Microservices
And much much more!
Inside the Course
Links all source code examples (Dozens of GitHub repositories are used for this course!)
Challenging Assignments
All slides are downloadable as PDFs for your reference and study
Course Extra - IntelliJ IDEA Ultimate
Students enrolling in the course can receive a free 4 month trial license to IntelliJ IDEA Ultimate! Get hands on experience using the Java IDE preferred by Spring Framework professionals!
Course Extra - Access to a Private Slack Community
You're not just enrolling in a course --> You are joining a community learning Spring.
With your enrollment to the course, you can access an exclusive Slack community. Get help from the instructor and other Spring Framework Gurus from around the world - in real time! This community is only available to students enrolled in this course.
This is a very active Slack community with hundreds Spring Framework Gurus from around the world!
When you enroll in this course, you can join this community of awesome gurus!