Skip to main content

Spring

Top 50 Spring Boot 4 Interview Questions and Answers (2026)

Fifty Spring Boot 4 interview questions with short answers that fit in a sentence or two aloud, from Boot 4.1 and proxies to Spring Security 7, Kafka, batch and Spring AI. Every answer links a deep dive that reproduced the behaviour by running code.

Spring GraphQL 2.0: Schema-First APIs, DataLoader Batching and Killing N+1

A naive @SchemaMapping resolver measured at 21 SQL statements for 20 books versus a @BatchMapping resolver's flat 2, via DataLoader batching and one .distinct() call. Plus a dangling foreign key nulling an entire GraphQL response through non-null propagation, byte-identical under both resolver strategies.

Zero-Downtime Database Migrations: Expand-Contract in Practice with Spring Boot

A real four-deploy expand-contract migration built with Spring Boot 4.1 and Flyway, proven live against two running replicas with a continuous-traffic load generator: 99.98% success, plus a genuine NOT NULL trap, a backfill-window bug, and H2 silently dropping a concurrently committed row during ALTER TABLE — confirmed to be a database-specific behavior, not a flaw in the technique.

Flyway vs Liquibase for Spring Boot 4: Migrations, Rollbacks and Baselines

A from-source comparison of Flyway 12.4.0 and Liquibase 5.0.3 on Spring Boot 4.1.1: checksum validation, out-of-order migrations, baselining an existing database, why Flyway Community has no working rollback, Liquibase's very different rollback and locking model, a real Liquibase 5.0.3 defect found and verified during testing, the FSL license change and its fallout at the ASF and Keycloak, and what happens when you run both tools against one database. Every claim traces to a companion project you can clone and run yourself.

Spring Batch on Boot 4.1: Jobs, Steps, Chunk Processing and Restartability

Spring Boot 4.1 ships Spring Batch 6.0. This article builds a real chunk-oriented import job against a CSV of products, deliberately breaks it on a duplicate row mid-run, and shows exactly what a restart resumes (and what it doesn't) against real captured output: a chunk that commits as a whole or not at all, a second JVM that resumes at row 41 instead of row 1, skip-instead-of-fail as the alternative to restarting, and the resourceless job repository that silently forgets a restart ever happened.

The Spring Cache Abstraction: @Cacheable, @CacheEvict, Key Generators and the Self-Invocation Trap

A beginner-first walk through Spring's application-level caching on Spring Boot 4.1.1: what the interceptor actually does, what SimpleKeyGenerator puts in the map, and the four traps that account for most caching bugs — self-invocation, key collisions, eviction timing, and declarations that only fail at the first call. Every figure comes out of a companion project whose 20 tests produce the transcripts. Includes two corrections: @EnableCaching has no exposeProxy attribute, and the documented cache-provider detection order does not match the enum that ships.