- Spring Boot manages the build of the microservices (jar/war) and the dependency injection (DI) context at runtime.
- Docker manages the packaging of microservice in a container and initializing the application’s phase-specific variables through OS/cluster-level environment variables.
- Kubernetes manages the actual network layout and provides the service discovery, load-balancing, and scaling.
By Animesh Singh and Erin Schnabel Microservices! Java! Yes, we know, you’ve heard both terms, and hopefully you also know these two terms go together very well: there are excellent frameworks in place to support building epic microservices in Java. Microservices are containerized in one way or another, and there’s some movement in the Java ecosystem around how those containers are built. You can pack everything into one “uber-jar” that you shove into a more generic Java container, or you can deploy a thinner WAR file into a more tailored image. The end goal for either approach is similar — a lightweight container with simple configuration that boots quickly using only essential components. Some frameworks that are becoming popular in this space include MicroProfile and Spring Boot. We talked about MicroProfile in a previous post. In this post, we’re focusing on Spring Boot. We just released a new developer pattern, Deploy Spring Boot microservices on Kubernetes, that shows off the power and convenience of Spring Boot. This framework takes an opinionated view of building Spring applications and is focused on getting you up and running as quickly as possible. You get the rapid deployment benefits of Spring Boot and the capabilities of the Spring framework, and you can then rely on services provided by the infrastructure for consistent behavior of key functions in a microservice architecture, even if other services aren’t written in Java. When you combine the convention-first approach with containers and container orchestrator systems like Kubernetes, you multiply your benefits. You not only get the microservices features from Spring Boot, but you can also rely on Kubernetes features like service routing, load balancing, scaling, and so on. In this developer pattern, you’ll learn how to deploy a sample Java microservices application based on Spring Boot on a Kubernetes cluster. We’re relying on Kubernetes to provide typical cloud capabilities: service discovery, load balancing, and cloud-managed configuration through Kubernetes ConfigMaps. To summarize: