Chaturmind
LearnDSASystem DesignInterview PrepDevOpsEngineering GrowthBlog
Start learning
Chaturmind

Structured learning paths for engineers who want to go deep. Written by practitioners.

Learn

  • Java
  • DSA
  • System Design
  • Spring Boot
  • AI / ML
  • DevOps
  • Engineering Growth
  • Java Interview Prep

Company

  • Blog
  • Contact

Legal

  • Privacy Policy
  • Terms of Service

© 2026 Chaturmind. All rights reserved.

Built for engineers who want to go deep.


← Java Interview Prep: 8+ Years (Senior & Lead)

Expert Core Java

  • Tricky Java Output, Operators & OOP Edge Cases — Interview Questions
  • Tricky Exceptions, Memory & Keyword Questions — Interview Questions
  • Classic Java Language Questions, Senior-Grade Answers — Interview Questions
  • Classic Collections, Threads & JDK APIs, Senior-Grade Answers — Interview Questions
  • Reflection, Dynamic Proxies, final & Modern OOP Design — Interview Questions

JVM Internals & Performance

  • Class Loading, Bytecode & Object Layout — Interview Questions
  • JIT Compilation & Runtime Optimisations — Interview Questions
  • Garbage Collectors Deep Dive — Interview Questions
  • JVM Tuning, GC Logs & Memory Footprint — Interview Questions
  • Memory Leaks, OutOfMemoryErrors & Profiling Tools — Interview Questions
  • Modules, Agents & Advanced JVM APIs — Interview Questions

Collections & Concurrency at Scale

  • Collections Internals & Complexity — Interview Questions
  • Iterators, Comparators & Ordering Contracts — Interview Questions
  • Concurrent Collections, Queues & Lock-Free Structures — Interview Questions
  • Threads, Executors & ForkJoin Internals — Interview Questions
  • Locks, Atomics, CAS & Synchronizers — Interview Questions
  • Java Memory Model, volatile, Fences & ThreadLocal — Interview Questions
  • Deadlock, Livelock, Starvation & Concurrent Design — Interview Questions
  • CompletableFuture, Parallel Streams & Non-Blocking I/O — Interview Questions

Modern Java (8 to 21+)

  • Lambdas & Functional Interfaces Internals — Interview Questions
  • Streams & Collectors Deep Dive — Interview Questions
  • Optional & Interface Default/Static Methods — Interview Questions
  • Java 9–25 Features & Virtual Threads — Interview Questions

Design Patterns, SOLID & Clean Code

  • Design Pattern Trade-offs & Combinations — Interview Questions
  • SOLID, Clean Code & Anti-Patterns — Interview Questions

Spring & Spring Boot Internals

  • IoC, Dependency Injection & Bean Lifecycle Internals — Interview Questions
  • Spring AOP, Proxies & @Async Internals — Interview Questions
  • Spring Configuration, Auto-Configuration & Custom Starters — Interview Questions
  • Spring MVC & REST Internals, Exception Frameworks — Interview Questions
  • Spring Security Advanced Internals — Interview Questions
  • Spring WebFlux, Reactor & R2DBC — Interview Questions
  • Spring Cloud, Observability & Distributed Tracing — Interview Questions
  • Spring Boot 3, Native Images & Production Scenarios — Interview Questions

JPA, Hibernate & Databases at Scale

  • Spring Data JPA — Queries, Projections, Custom Repositories & Locking — Interview Questions
  • JPA Entity Mapping, Associations & Cascades — Interview Questions
  • JPQL vs Native Queries in Depth — Interview Questions
  • Hibernate Caching — First-Level, Second-Level & Query Cache — Interview Questions
  • Lazy vs Eager Loading, LazyInitializationException & N+1 — Interview Questions
  • JPA Transactions, Propagation, Isolation & Dirty Checking — Interview Questions
  • SQL vs NoSQL, Indexing & Query Tuning — Interview Questions
  • Database Scaling, Replication, Pooling & Consistency Models — Interview Questions
  • Redis, Search, Time-Series, CDC & Transactional Data Modelling — Interview Questions

Testing Strategy & API Design

  • Spring Boot Test Slices, Context & Test Strategy — Interview Questions
  • Testing Web, Persistence, Security, Async & Messaging in Spring Boot — Interview Questions
  • JUnit 5 & Mockito, Advanced — Interview Questions
Chaturmind
← Java Interview Prep: 8+ Years (Senior & Lead)

Expert Core Java

  • Tricky Java Output, Operators & OOP Edge Cases — Interview Questions
  • Tricky Exceptions, Memory & Keyword Questions — Interview Questions
  • Classic Java Language Questions, Senior-Grade Answers — Interview Questions
  • Classic Collections, Threads & JDK APIs, Senior-Grade Answers — Interview Questions
  • Reflection, Dynamic Proxies, final & Modern OOP Design — Interview Questions

JVM Internals & Performance

  • Class Loading, Bytecode & Object Layout — Interview Questions
  • JIT Compilation & Runtime Optimisations — Interview Questions
  • Garbage Collectors Deep Dive — Interview Questions
  • JVM Tuning, GC Logs & Memory Footprint — Interview Questions
  • Memory Leaks, OutOfMemoryErrors & Profiling Tools — Interview Questions
  • Modules, Agents & Advanced JVM APIs — Interview Questions

Collections & Concurrency at Scale

  • Collections Internals & Complexity — Interview Questions
  • Iterators, Comparators & Ordering Contracts — Interview Questions
  • Concurrent Collections, Queues & Lock-Free Structures — Interview Questions
  • Threads, Executors & ForkJoin Internals — Interview Questions
  • Locks, Atomics, CAS & Synchronizers — Interview Questions
  • Java Memory Model, volatile, Fences & ThreadLocal — Interview Questions
  • Deadlock, Livelock, Starvation & Concurrent Design — Interview Questions
  • CompletableFuture, Parallel Streams & Non-Blocking I/O — Interview Questions

Modern Java (8 to 21+)

  • Lambdas & Functional Interfaces Internals — Interview Questions
  • Streams & Collectors Deep Dive — Interview Questions
  • Optional & Interface Default/Static Methods — Interview Questions
  • Java 9–25 Features & Virtual Threads — Interview Questions

Design Patterns, SOLID & Clean Code

  • Design Pattern Trade-offs & Combinations — Interview Questions
  • SOLID, Clean Code & Anti-Patterns — Interview Questions

Spring & Spring Boot Internals

  • IoC, Dependency Injection & Bean Lifecycle Internals — Interview Questions
  • Spring AOP, Proxies & @Async Internals — Interview Questions
  • Spring Configuration, Auto-Configuration & Custom Starters — Interview Questions
  • Spring MVC & REST Internals, Exception Frameworks — Interview Questions
  • Spring Security Advanced Internals — Interview Questions
  • Spring WebFlux, Reactor & R2DBC — Interview Questions
  • Spring Cloud, Observability & Distributed Tracing — Interview Questions
  • Spring Boot 3, Native Images & Production Scenarios — Interview Questions

JPA, Hibernate & Databases at Scale

  • Spring Data JPA — Queries, Projections, Custom Repositories & Locking — Interview Questions
  • JPA Entity Mapping, Associations & Cascades — Interview Questions
  • JPQL vs Native Queries in Depth — Interview Questions
  • Hibernate Caching — First-Level, Second-Level & Query Cache — Interview Questions
  • Lazy vs Eager Loading, LazyInitializationException & N+1 — Interview Questions
  • JPA Transactions, Propagation, Isolation & Dirty Checking — Interview Questions
  • SQL vs NoSQL, Indexing & Query Tuning — Interview Questions
  • Database Scaling, Replication, Pooling & Consistency Models — Interview Questions
  • Redis, Search, Time-Series, CDC & Transactional Data Modelling — Interview Questions

Testing Strategy & API Design

  • Spring Boot Test Slices, Context & Test Strategy — Interview Questions
  • Testing Web, Persistence, Security, Async & Messaging in Spring Boot — Interview Questions
  • JUnit 5 & Mockito, Advanced — Interview Questions
HomeLearnJava Interview PrepJava Interview Prep: 8+ Years (Senior & Lead)Spring & Spring Boot Internals
✓ FreeAdvanced· 11 min read

Spring Boot 3, Native Images & Production Scenarios — Interview Questions

What's new in Spring Boot 3 and Spring Framework 6 (Jakarta EE 10, Java 17 baseline, observability, AOT, Problem Details, virtual threads, RestClient), native images and how GraalVM works (closed-world AOT, reachability metadata), refreshing stale caches with minimal disruption, choosing transaction propagation across "service calls" (and why propagation stops at process boundaries), containerising Spring Boot properly, custom Actuator health for go-live, zero-downtime deployments, and Docker build commands and registries.

Published September 25, 2026


How to use this lesson

These are "you're responsible for production" questions. Show:

  • awareness of what changed in the platform (Boot 3 / Spring 6 / Java 17+);
  • operational judgement: caches, transactions, deployments and health checks;
  • correct framing: for example, Spring transactions don't propagate across microservices.

Q1. What are the major new features in Spring Boot 3?

Short answer:

  • Baselines: Java 17+ and Jakarta EE 10 (javax.* → jakarta.*), on Spring Framework 6.
  • Observability: the Micrometer Observation API for unified metrics and tracing (Micrometer Tracing, replacing Sleuth), OTLP export, and structured logging (3.4).
  • GraalVM native images as a first-class option (AOT processing), plus CDS/AOT cache support for faster JVM startup (3.3+).
  • Virtual threads support (spring.threads.virtual.enabled, 3.2).
  • HTTP interface clients, and the new RestClient (3.2), plus JdbcClient.
  • Problem Details (RFC 7807/9457) error responses.
  • Docker Compose and Testcontainers development-time support (@ServiceConnection, 3.1).
  • SSL bundles (3.1).
  • Improved configuration and auto-configuration (AutoConfiguration.imports), and @MockitoBean in tests (3.4).
  • Removed: spring.factories auto-configuration registration, and many deprecated properties.

Migration: use the OpenRewrite Spring Boot 3 recipes, and upgrade to Boot 2.7 first, clearing the deprecations.

Q2. What changed in Spring Framework 6?

Short answer:

  • The Jakarta EE 9+ namespace, and a Java 17 baseline (so records, sealed classes and text blocks are usable internally).
  • AOT (ahead-of-time) processing infrastructure, for native images and faster startup.
  • The Observability API (Micrometer).
  • Problem Details support (ProblemDetail, ErrorResponse).
  • HTTP interface clients (@HttpExchange).
  • RestClient/JdbcClient (6.1).
  • Virtual threads friendliness, and CRaC support (6.1).
  • New method validation (HandlerMethodValidationException, 6.1).
  • Spring Security 6 alignment (lambda DSL, SecurityFilterChain only).
  • Removals: old integrations (such as EJB and JCA pieces, and some legacy remoting).

Spring Framework 7 (late 2025) continues with JSpecify nullness, API versioning, and Jakarta EE 11.

Q3. What is a native image in Spring, and how does GraalVM work?

Short answer:

  • GraalVM Native Image performs ahead-of-time compilation of the application, its libraries and the JDK into a standalone native executable. It does a closed-world static analysis from the entry points, finding all reachable code, and compiles only that. It also initialises some classes at build time, and snapshots the heap.
  • The result:
    • startup in milliseconds;
    • a much smaller memory footprint;
    • no JIT warm-up;
    • smaller container images.
  • The costs:
    • long builds (minutes, and lots of RAM);
    • lower peak throughput than the JIT without profile-guided optimisation (PGO, in Oracle GraalVM);
    • dynamic features need metadata: reflection, proxies, resources, serialisation and JNI require reachability metadata (reflect-config.json, RuntimeHints);
    • limited runtime flexibility (no classpath scanning at runtime, and fixed configuration choices at build time);
    • debugging and profiling differences.
  • In Spring (Boot 3+):
    • AOT processing at build time evaluates the bean definitions, conditions and proxies, and generates source code plus hints;
    • ./mvnw -Pnative native:compile, or spring-boot:build-image with the native profile (buildpacks);
    • the GraalVM Reachability Metadata Repository supplies hints for common libraries;
    • you register your own with @RegisterReflectionForBinding or RuntimeHintsRegistrar.
  • Good fits: serverless and scale-to-zero, CLIs, sidecars, and dense multi-tenant deployments. For long-running, high-throughput services, the JVM (with a CDS or AOT cache) is often still better.

Q4. Your cache goes stale because the underlying data changes frequently. How do you decide when to refresh, and how do you minimise disruption?

Short answer: First, decide the freshness requirement per data type ("prices must be at most 5 seconds stale; catalogue text can be 1 hour"). Then combine these strategies:

  • Event-driven invalidation: on a write, publish an event after the transaction commits (the outbox, CDC or @TransactionalEventListener), and evict or update the affected keys on all instances. Use Redis pub/sub, or Kafka, for local-cache fan-out.
  • TTL as a safety net, sized to the tolerable staleness, with jitter (so keys don't all expire at once).
  • Refresh-ahead (refreshAfterWrite in Caffeine): serve the current value while reloading it asynchronously, so users never wait on a cold miss.
  • Write-through, or updating the cache in the write path, for read-after-write consistency on critical data.
  • Stampede protection: request coalescing (a single loader per key, sync=true), soft TTLs, and stale-while-revalidate.
  • Versioned keys, for bulk changes or schema changes (switch the key prefix atomically, and warm the new keys first).
  • Measure: hit ratio, staleness (compare samples with the source), and eviction rates.
  • For highly volatile data, don't cache it (or cache it for sub-second periods), and optimise the source instead.

Learn it in depth → Caching Strategies

Q5. A transaction spans several service calls. How do you choose the propagation level for each call? What are the pitfalls?

Short answer: First, clarify what "service calls" means:

  • Calls between Spring beans in the same application (same JVM, same database): propagation applies.
    • REQUIRED (the default) for steps that must commit or roll back together (create order + reserve stock + write the outbox).
    • REQUIRES_NEW for work that must commit independently: an audit or failure log that must persist even if the main transaction rolls back, or a sequence or ID allocation.
    • NESTED (savepoints, with JDBC or DataSourceTransactionManager) for partial rollback of an optional sub-step.
    • MANDATORY for methods that must never run outside a transaction (it's an assertion).
    • NOT_SUPPORTED/NEVER for long reads or remote calls that shouldn't hold a transaction.
  • Calls to other microservices (HTTP or messaging): Spring propagation doesn't cross process boundaries. Each service has its own local transaction. Use sagas, the outbox pattern and idempotency. Keep remote calls outside database transactions.

The pitfalls:

  • REQUIRES_NEW holds two connections (the outer one is suspended, not released), so under load you can get connection-pool exhaustion or deadlock.
  • Self-invocation means the propagation attribute is ignored.
  • UnexpectedRollbackException: an inner REQUIRED method marks the shared transaction rollback-only, even if the caller catches the exception.
  • Long transactions cause lock contention and deadlocks.
  • Checked exceptions don't trigger rollback by default.
  • NESTED isn't supported by the JPA transaction manager (it's supported by DataSourceTransactionManager).

Q6. How do you prepare a Spring Boot application for Docker, and what best practices do you follow?

Short answer:

  1. Build reproducibly:

    • buildpacks (./mvnw spring-boot:build-image), Jib, or a multi-stage Dockerfile;
    • layered JARs (java -Djarmode=tools -jar app.jar extract --layers), so dependencies are cached in their own layer;
    • pin the base image version;
    • use a JRE, distroless or minimal image.

    Alpine uses musl, so use JDK builds made for musl, or prefer Debian-slim or distroless glibc images, to avoid surprises.

  2. Run securely: a non-root user, a read-only root file system (with /tmp as a volume), no build tools in the runtime image, image scanning (Trivy or Grype), and signed images (cosign).

  3. Make it container-friendly:

    • -XX:MaxRAMPercentage=70–75;
    • server.shutdown=graceful, plus a pre-stop delay;
    • liveness and readiness probes (/actuator/health/liveness|readiness);
    • logs to stdout (JSON);
    • configuration and secrets through environment variables or mounted files;
    • no state in the container.
  4. Speed up startup: CDS or AOT caches (Boot 3.3+), or native images, where appropriate.

  5. CI/CD: tag images with the Git SHA (immutable), push them to a private registry, promote the same image through the environments, and generate an SBOM.

Learn it in depth → Multi-Stage Builds

Q7. Your application is going live, and you own monitoring. How would you customise Actuator for application-specific health and metrics?

Short answer:

  • Custom HealthIndicators for the critical dependencies: the payment gateway, the Kafka producer, and a third-party API with a cached status. Return UP/DOWN/OUT_OF_SERVICE, with details.
  • Health groups for probes:
    • management.endpoint.health.group.readiness.include=db,redis,paymentGateway;
    • liveness includes only internal state, never external dependencies, or a database outage would cause restart storms.
  • Details: management.endpoint.health.show-details=when-authorized, not always on a public endpoint (that leaks internals). Expose Actuator on a separate management port, and secure it.
  • Business metrics: Micrometer counters and timers (orders.placed, payments.failed{provider}, checkout.duration), gauges (queue depth), and @Observed for key flows. Enable histogram percentiles for SLOs.
  • /info: build and Git information, for release tracking.
  • Scrape and alert: the /actuator/prometheus endpoint, Grafana dashboards, and SLO-based alerts. Wire in readiness gating for deployments.
@Component("paymentGateway")
class PaymentGatewayHealth implements HealthIndicator {
    private final PaymentClient client;
    PaymentGatewayHealth(PaymentClient client) { this.client = client; }
    @Override public Health health() {
        var status = client.lastKnownStatus();                              // cached; don't call the provider per probe
        return status.ok() ? Health.up().withDetail("latencyMs", status.p95()).build()
                           : Health.outOfService().withDetail("reason", status.error()).build();
    }
}

Learn it in depth → Health Checks

Q8. How do you achieve zero-downtime deployments for a Spring Boot e-commerce application?

Short answer:

  • The application side:
    • Graceful shutdown (server.shutdown=graceful, plus a lifecycle timeout).
    • Readiness probes that go DOWN before shutdown (Kubernetes sends SIGTERM, and a preStop sleep lets the load balancer deregister the pod).
    • Stateless instances (sessions in Redis or tokens).
    • Backward-compatible APIs and events.
  • The deployment strategy:
    • rolling updates (maxUnavailable: 0, maxSurge: 1+), with readiness gates;
    • or blue-green (switch traffic at the load balancer or ingress, with an instant rollback);
    • or canary (1% → 10% → 50% → 100%, with automated analysis: Argo Rollouts or Flagger).
  • The database: expand/contract migrations, so the old and new versions both work with the schema during the rollout. Never apply a breaking migration in the same release.
  • Message consumers: tolerate the old and new event versions, and pause or resume carefully.
  • Feature flags to separate deploy from release.
  • Verification and rollback: automated smoke tests, SLO monitoring, and one-click rollback.

Learn it in depth → Deployment Strategies

Q9. What are the basic commands to create a Docker image, and where do you store the images?

Short answer:

docker build -t registry.example.com/shop/orders:1.8.3-3f2c9ab .     # build, with an immutable tag (version + Git SHA)
docker run --rm -p 8080:8080 -e SPRING_PROFILES_ACTIVE=dev registry.example.com/shop/orders:1.8.3-3f2c9ab
docker login registry.example.com
docker push registry.example.com/shop/orders:1.8.3-3f2c9ab
# Without a Dockerfile:
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=registry.example.com/shop/orders:1.8.3
# Multi-architecture (amd64 + arm64):
docker buildx build --platform linux/amd64,linux/arm64 -t registry.example.com/shop/orders:1.8.3 --push .

Storage: a private container registry:

  • AWS ECR, Google Artifact Registry, Azure Container Registry, GitHub Container Registry;
  • or self-hosted Harbor, JFrog Artifactory or Nexus.

It should have vulnerability scanning, retention and cleanup policies, immutable tags, access control (IAM or robot accounts), and replication for disaster recovery or multiple regions. Docker Hub works for public images, but has rate limits.

Follow-up questions this topic invites — and their answers

Q: What's the biggest effort in a Boot 2 → 3 migration? A: The javax → jakarta package change (in your code and all your dependencies), Spring Security 6's configuration changes, Hibernate 6 query and dialect differences, removed deprecated properties, and third-party libraries that aren't yet Jakarta-compatible. OpenRewrite automates much of it.

Q: How do you make a Spring application native-image friendly? A: Avoid runtime reflection and classpath scanning outside Spring's AOT support, register runtime hints for reflection and resources, prefer constructor injection and functional bean registration, test with nativeTest, and keep an eye on library support in the reachability metadata repository.

Q: What does spring.threads.virtual.enabled=true change? A: Tomcat or Jetty request handling, @Async and @Scheduled task executors, and several integrations switch to virtual threads. Blocking I/O no longer ties up platform threads. Watch out for pinning (before Java 24), and for downstream pool limits.

Q: Why shouldn't readiness include every downstream dependency? A: If a shared dependency goes down, every instance becomes "not ready", and the service disappears from load balancers completely. Include only the dependencies without which the instance truly can't serve useful traffic, and degrade gracefully for the rest.

Previous

Spring Cloud, Observability & Distributed Tracing — Interview Questions

Next

Spring Data JPA — Queries, Projections, Custom Repositories & Locking — Interview Questions

AI Tutor

Lesson: Spring Boot 3, Native Images & Production Scenarios — Interview Questions

Quick actions

AI responses can be inaccurate. Verify critical information.