Skip to the page

Java and Spring · 24 concepts

Spring Boot

Get ready for Spring Boot interviews: the container, REST APIs, JPA, security, microservices and real production incidents.

Asked in these mock interviews

Part 1 · 4 concepts

Spring Boot core

  1. 01

    The container, beans and dependency injection

    The Spring container creates objects called beans and passes in what they need. Use constructor injection. When two beans have the same type, Spring does not guess: you…

  2. 02

    Bean scopes, @Component and @Bean

    Singletons are shared by all requests and must hold no mutable state. A prototype inside a singleton is created only once. Use @Bean when you control construction.

  3. 03

    Auto-configuration and where properties come from

    A starter brings dependencies. Auto-configuration creates beans only when conditions match. Property sources have an order, and a higher one wins.

  4. 04

    Proxies, @Transactional and AOP

    Annotations such as @Transactional work through a proxy. A call from inside the same class skips the proxy, so the annotation does nothing.

Part 2 · 5 concepts

Spring REST APIs

  1. 05

    How a request reaches your controller, and validation

    A request passes servlet filters, then DispatcherServlet, then your controller method. Validate the shape with Bean Validation and return a clear 400.

  2. 06

    Error handling with @RestControllerAdvice

    A global handler maps exceptions to the right status and a safe body. Never return 200 for errors, and never leak internal messages.

  3. 07

    Pagination and API versioning

    Page runs a count query on every call; Slice and keyset scrolling do not. Version an API only for breaking changes, and keep old versions alive for old clients.

  4. 08

    Idempotency keys and large uploads

    Retries can charge twice unless the server remembers the request. Large uploads should not pass through the API's memory.

  5. 09

    HTTP clients, virtual threads and WebFlux

    Use RestClient or an HTTP interface for new calls. For I/O-bound services, MVC on virtual threads is usually simpler than WebFlux, but you must add your own limits.

Part 3 · 5 concepts

JPA and Hibernate

  1. 10

    Entity states, flush and dirty checking

    A managed entity is tracked by the persistence context. At commit Hibernate compares it with a snapshot and writes changes. An entity outside a transaction is detached…

  2. 11

    Lazy loading, N+1 and open-in-view

    Associations should be lazy and fetched per use case. Touching lazy data in a loop causes N+1 queries. Open-in-view hides the problem and holds connections.

  3. 12

    Transaction propagation and rollback rules

    By default only unchecked exceptions roll back. REQUIRES_NEW needs a call through the proxy. Keep transactions short and never call remote services inside them.

  4. 13

    Optimistic locking and Hibernate caches

    A @Version column stops lost updates. The second-level cache is per JVM unless clustered. For stock, use one atomic UPDATE.

  5. 14

    Bulk imports, projections and Flyway migrations

    Bulk work needs JDBC batching and chunks, not entities one by one. Read-only reports need projections or SQL. Migrations must be safe to run and to roll forward.

Part 4 · 3 concepts

Spring Security

  1. 15

    The filter chain and JWT resource servers

    Spring Security is a chain of servlet filters. A resource server checks the JWT signature, issuer and expiry. Use the issuer address so key rotation works.

  2. 16

    Object-level authorization, CORS and reviewing a config

    Checking the role is not enough: check that the user owns the object. CORS belongs inside the security chain. Rules match top to bottom.

  3. 17

    Sessions or JWTs, and password hashing

    JWTs are easy to check but hard to revoke. Sessions revoke at once but need shared state. Passwords need a slow, salted hash, and old hashes can be migrated on login.

Part 5 · 4 concepts

Spring microservices

  1. 18

    Gateway, configuration and service discovery

    A gateway routes and protects traffic at the edge. Configuration comes from Git, ConfigMaps or a secrets manager. In Kubernetes use native services for discovery.

  2. 19

    Resilient calls: clients, timeouts, retries and circuit breakers

    Every call between services needs timeouts, careful retries and a circuit breaker. A slow optional service must not take checkout down.

  3. 20

    Kafka consumers, retries and duplicates

    Each partition goes to one consumer in a group. Delivery is at least once, so handlers must be idempotent. Poison messages need a dead-letter plan. Slow processing…

  4. 21

    The outbox pattern and distributed tracing

    A database write and a message are two systems, so one can fail alone. Use an outbox row in the same transaction. Tracing needs propagation to be set up on every hop.

Part 6 · 3 concepts

Spring in production

  1. 22

    Probes, startup, Actuator and logging

    Liveness and readiness answer different questions. Actuator endpoints are powerful and must be protected. Log levels can change at runtime.

  2. 23

    Connection pools, memory growth and async work

    Pool exhaustion, unbounded caches and unbounded async queues are the usual Spring production failures. Each leaves a clear sign in metrics.

  3. 24

    Integration tests and upgrading to Boot 4

    Test with a real database in a container, keep the context cache working, and plan the Boot 3.5 to 4 upgrade in clear steps.

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview