This episode covers microservices architecture and cloud-native Java: an introduction to microservices and modern Java frameworks, Spring Boot, Jakarta EE, Micronaut, Quarkus, and Helidon, Java containerization and GraalVM native images, plus integration of service discovery, circuit breakers, and observability.

Modern applications rarely run alone — they become part of an ecosystem of interconnected services. Episode 20 covers microservices and cloud-native Java: the architecture that breaks applications into small services, modern Java frameworks, containerization, and service integration.
Cloud-native is a new way of building and running software: containers, orchestration, and independent services. You will understand the microservices pattern and the frameworks that support it.
Microservices break an application into small, independent services — each service has a single responsibility, its own data, and separate deployment. Services communicate over the network with REST, gRPC, or message brokers.
The benefits: per-service scaling, failure isolation, and autonomous teams. The challenges: network complexity, distributed data, and harder observability.
A monolith is simpler for small applications; microservices excel when the application is large with many teams:
monolit: satu aplikasi, satu deployment
microservices: banyak layanan, banyak deploymentSpring Boot is the most popular framework for Java microservices. Create a project quickly with Spring Initializr:
curl -s https://start.spring.io/starter.zip \
-d type=maven-project \
-d dependencies=web,actuator \
-o demo.zip
unzip demo.zipMicronaut and Quarkus are designed specifically for cloud-native with fast startup and low memory consumption, and support native (AOT) compilation. Helidon from Oracle also offers reactive and microprofile modes. The framework choice depends on your needs: Spring Boot for the largest ecosystem, Quarkus for cloud-native and serverless, Micronaut for performance.
Containers make applications portable. Create a Dockerfile for a Java application:
FROM maven:3.9-eclipse-temurin-21 AS build
WORKDIR /app
COPY pom.xml .
RUN mvn dependency:go-offline
COPY src ./src
RUN mvn package -DskipTests
FROM eclipse-temurin:21-jre
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]Build the image:
docker build -t aplikasi-demo:1.0.0 .
docker run -p 8080:8080 aplikasi-demo:1.0.0docker build -t aplikasi-demo:1.0.0 . builds the image from the Dockerfile, and docker run runs it.
GraalVM native images compile a Java application into a native executable that starts in milliseconds and uses far less memory — ideal for serverless functions:
native-image -jar aplikasi.jar aplikasi-nativenative-image -jar aplikasi.jar produces a native binary that runs without a JVM.
Services need to find each other in dynamic environments. Service discovery uses a registry such as Consul, Eureka, or Kubernetes DNS:
layanan A -> service registry -> menemukan layanan BA circuit breaker prevents cascading failures: if one service fails, calls are cut off temporarily instead of waiting for timeouts. Resilience4j is a popular library:
import io.github.resilience4j.circuitbreaker.CircuitBreaker;
import io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry;
public class DemoCircuitBreaker {
public static void main(String[] args) {
CircuitBreakerRegistry registry = CircuitBreakerRegistry.ofDefaults();
CircuitBreaker cb = registry.circuitBreaker("layanan-pembayaran");
System.out.println("State: " + cb.getState());
}
}Microservices demand observability: metrics, structured logs, and distributed tracing. Spring Boot Actuator, Micrometer, and OpenTelemetry (discussed in episode 22) are the foundations of service monitoring.
Episode 20 covers microservices and cloud-native Java: microservices architecture, the Spring Boot, Micronaut, Quarkus, and Helidon frameworks, containerization with Docker and GraalVM native images, plus service discovery, circuit breakers, and observability.
Key takeaways:
In the next episode, episode 21, we will discuss CI/CD and production deployment — Continuous Integration and Continuous Delivery with GitHub Actions, build and release management with semantic versioning, deployment to servers and Kubernetes, and rollback strategies plus blue-green deployment. Time to take code to production!