Java Microservices with Spring in 2 Weeks
Published by O'Reilly Media, Inc.
Spring Boot + Spring Cloud best practices for creating effective and resilient microservices
Microservices have become a de facto standard architecture pattern of today’s software. Due to their nature, microservices give developers a lot of freedom in using the right tool and language to solve a given business problem. The Spring Framework—specifically Spring Boot and Spring Cloud— have revolutionized modern Java microservice development. With these frameworks you can set up your applications in no time, reusing abstractions dedicated to working in the cloud regardless of your chosen platform.In this 2 week course, we will look at how Spring Boot and Spring Cloud work with Kubernetes to create and deploy your microservices. We will also learn how you can leverage those frameworks to do HTTP and messaging based communication. This course is targeted for everyone writing Spring based microservices. You’ll learn how to make your microservices communicate in a resilient manner and how to interact with your deployed to production application.
Week 1: Introduction to Microservices with Spring Boot & Spring Cloud
We can see that more and more companies are creating microservices and are deploying them into Kubernetes. Since Spring Boot is the de facto standard for such setup it’s good to review the changes in its latest versions that offer best out-of-the-box support for Kubernetes.
In Week 1 of this course, we will look into some of the most fundamental features of Spring Cloud that abstract the underlying platform where the application got deployed to. We will also answer the question when to use and when to not use Spring Cloud Kubernetes.
Week 2: Microservice Communication with Spring Boot & Spring Cloud
Applications deployed to a cloud never remain in isolation. They need to communicate with each other - the most common means are HTTP and messaging. There are quite a few questions we should pose and answer before we start coding. Since we don’t have knowledge of the IP and port of applications deployed to a cloud, how can we actually make an HTTP call? How can we easily set up a messaging communication? What if the communication is faulty? How can we ensure that our applications do not propagate failure? What if we want to put an API gateway on the edge of our system - what’s the easiest way to write one?
In Week 2 of this course, we will tackle all of those problems by using Spring Boot and Spring Cloud. We will see how to leverage service discovery so as not to hardcode IP and ports of other applications. We will use circuit breakers to ensure that our system is stable when one of its components is misbehaving. We will build an API gateway using Spring Cloud Gateway. What about messaging? We will see what Spring Cloud Stream is and how we can decouple messaging functions from the broker to which the messages will be sent.
NOTE: With today’s registration, you’ll be signed up for all 3 sessions. Although you can attend any of the sessions individually, we recommend participating in all 2 weeks.
What you’ll learn and how you can apply it
By the end of this live, hands-on 2-part series, you’ll understand:
Week 1: Introduction to Microservices with Spring Boot & Spring Cloud
- What Spring Boot is
- How Spring Cloud depends on Spring Boot
- How Spring Boot, Spring Cloud, and Kubernetes work best together
Week 2: Microservice Communication with Spring Boot & Spring Cloud
- What Service Discovery is
- How to set up communication between microservices in a resilient manner via HTTP and messaging
- What an API gateway is
And you’ll be able to:
Week 1: Introduction to Microservices with Spring Boot & Spring Cloud
- Create Docker containers of Spring Boot applications
- Refresh the application configuration with Spring Cloud Config server and client
- Work with Spring Boot and Kubernetes
Week 2: Microservice Communication with Spring Boot & Spring Cloud
- Communicate with microservices over HTTP and messaging
- Create an API gateway configured via YAML and Java code
- Make your microservices communicate in a resilient way
This live event is for you because...
- You’re a software developer and a Java engineer
- You work with microservices
- You want to become a proficient microservice developer
Prerequisites
- Familiarity with the Spring Framework
- A basic understanding of Docker
Recommended preparation:
- Take Spring and Spring Boot in 3 Weeks (live online training course with Ken Kousen)
- Take Microservices Bootcamp (live online training course with Sam Newman)
- Take Microservices Fundamentals (live online training course with Sam Newman)
Recommended follow-up:
- Read Building Microservices with Spring Boot (book)
- Read Building Microservices, second edition (book)
- Read Spring Boot Up and Running (book)
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
Week 1
Spring Boot and Project Initializr (50 minutes)
- Presentation: Introduction to Spring Boot and Project Initializr. Showing how dependency management works and how Project Initializr can generate projects in various ways.
- Demo & Exercise: Project Initializr and basic concepts of Spring Boot
- Q&A
- Break (10 minutes)
Spring Cloud and Context Refresh (50 minutes)
- Presentation: Introduction to what Spring Cloud is, how the context refreshing works
- Demo & Exercise: Context Refreshing
- Q&A
- Break (10 minutes)
Configuration Management with Spring Cloud Config (50 minutes)
- Presentation: Introduce the concepts of Configuration Management by means of Spring Cloud Config server. Explain how to set up the server and the client side.
- Demo & Exercise: Reading configuration from an external source.
- Q&A
- Break (10 minutes)
Spring Boot & Spring Cloud & Kubernetes (45 minutes)
- Presentation: Explain what Spring Boot, Spring Cloud and Kubernetes have to do with each other.
- Demo & Exercise: Creation of a Docker image of a Spring Boot application and how the application changes its behaviour when deployed to Kubernetes.
Wrap-up and Q&A: 15 minutes
Week 2
Spring Cloud and Service Discovery (55 minutes)
- Presentation: Introduction to Service Discovery on the example of Spring Cloud.
- Demo & Exercise: Creation of a client and server HTTP applications that talk to each other via Service Discovery.
- Q&A (5 minutes)
- Break (5 minutes)
Resilient HTTP Communication with Spring Cloud Circuit Breaker (50 minutes)
- Presentation: Introduction to Circuit Breakers and how Spring Cloud Circuit Breaker works.
- Demo & Exercise: Enhancing our previous example to use a Circuit Breaker.
- Q&A (5 minutes)
- Break (10 minutes)
Message based communication with Spring Cloud Stream (50 minutes)
- Presentation: Introduction to messaging, basics of Spring Cloud Stream.
- Demo & Exercise: Live coding of message-based communication between two microservices.
- Q&A (5 minutes)
- Break (10 minutes)
Writing an API Gateway using Spring Cloud Gateway (45 minutes)
- Presentation: Introduction to the API Gateway, showing the basics of Spring Cloud Gateway.
- Demo & Exercise: Spring Cloud Gateway with YAML and code based configuration.
Wrap-up and Q&A: 15 minutes
Your Instructor
Marcin Grzejszczak
Marcin Grzejszczak is a software engineer at Broadcom, where he works on Spring Cloud Contract, and Micrometer projects. He’s written two books on Mockito and coauthored multiple video courses.