Glossary
86 practical terms for Java backend interviews and day-to-day work.
- @Transactional propagation
- Controls how a transactional method joins an existing transaction:
REQUIRED(default) joins,REQUIRES_NEWsuspends and starts a separate one,MANDATORYdemands one. By default only unchecked exceptions roll back, and a rollback inside a joined call marks the whole outer transaction rollback-only. See also: ProxyIsolation levelDirty checking - 12-factor app
- A set of practices for cloud-native services: config in the environment, stateless processes, logs as event streams, disposable processes and dev/prod parity. In Spring Boot this means externalised config and no local-disk or in-memory session state. See also: ProfileStructured loggingGraceful shutdown
- Actuator
- Spring Boot module exposing operational endpoints such as
/actuator/health,metricsandprometheus. Expose only what you need and protect the rest; an openheapdumporenvendpoint is a serious leak. See also: Liveness vs readinessObservabilityProfile - AOP (Aspect-Oriented Programming)
- Moves cross-cutting concerns such as logging, metrics and security out of business code into aspects applied by pointcut. Spring AOP works through runtime proxies, so it only advises public calls on Spring beans coming from outside. See also: Proxy@Transactional propagationBean
- API gateway
- A single entry point that routes requests to backend services and handles cross-cutting concerns such as auth, rate limiting, TLS and request logging (Spring Cloud Gateway, Kong). Keep business logic out of it or it becomes a bottleneck and a deployment coupling point. See also: Rate limitingService discoveryJWT (JSON Web Token)
- At-least-once delivery
- The broker redelivers until acknowledged, so no message is lost but duplicates happen (Kafka consumers after a rebalance, SQS visibility timeouts). Make consumers idempotent. See also: Exactly-once processingIdempotency keyDLQ (dead-letter queue)
- Auto-configuration
- Spring Boot's mechanism for registering beans based on the classpath and properties, using
@ConditionalOn...rules. If a bean of that type is defined by you it backs off; debug what applied with--debugor the conditions report. See also: StarterBeanProfile - Backpressure
- A mechanism by which a slow consumer signals producers to slow down instead of letting queues grow without bound. Bounded queues,
Fluxdemand in Reactor, and rejecting with HTTP 429/503 are all forms of it. See also: Thread poolRate limitingCircuit breaker - BCrypt
- A deliberately slow, salted password-hashing function with a tunable cost factor, the usual
PasswordEncoderin Spring Security. Never store passwords with plain SHA-256 or MD5; note that bcrypt truncates input at 72 bytes. See also: HMACJWT (JSON Web Token)RBAC (Role-Based Access Control) - Bean
- An object whose lifecycle is managed by the Spring container, declared with
@Component,@Serviceor an@Beanmethod. Only objects obtained from the container get injection, proxies and AOP; callingnewon your own class bypasses all of it. See also: IoC (Inversion of Control)Bean scopeProxy - Bean scope
- Defines how many instances Spring creates:
singleton(default, one per context),prototype, or web scopes such asrequest. Singletons are shared by all threads, so never keep per-request mutable state in fields. See also: BeanRace conditionThreadLocal - Blue/green deployment
- Run the old (blue) and new (green) versions side by side and switch traffic over at once, keeping blue for instant rollback. Database schema changes must stay compatible with both versions. See also: Canary releaseSchema migrationGraceful shutdown
- Bytecode
- The platform-independent instruction set stored in
.classfiles, executed by the JVM interpreter or compiled by the JIT. Inspect it withjavap -c; frameworks such as Hibernate and Spring generate or rewrite it at run time to build proxies. See also: JIT compiler (just-in-time)ClassLoaderProxy - Cache stampede
- When a hot key expires, many concurrent requests miss at once and all hit the database. Mitigate with per-key locking or request coalescing, jittered TTLs, or refreshing before expiry (Caffeine's
refreshAfterWrite). See also: Cache-asideTTL (time to live)Rate limiting - Cache-aside
- The application checks the cache first, on a miss loads from the database and populates the cache, and invalidates or updates on writes. It is what Spring's
@Cacheabledoes; the hard part is invalidation and stale data. See also: Write-through cacheCache stampedeTTL (time to live) - Canary release
- Send a small percentage of traffic to the new version, watch error rate and latency, then ramp up or roll back. It only works if you have per-version metrics and automated rollback criteria. See also: Blue/green deploymentSLO (Service Level Objective)Observability
- CAP theorem
- During a network partition a distributed store must choose between consistency and availability; it cannot have both. It is a statement about behaviour under partition, not a menu of three picks at all times. See also: Eventual consistencyReplication lagSharding
- CAS (compare-and-swap)
- An atomic CPU instruction that updates a value only if it still equals an expected one; it underpins
AtomicInteger,ConcurrentHashMapand lock-free structures. Under heavy contention the retry loop burns CPU, so preferLongAdderfor hot counters. See also: volatileRace conditionHappens-before - Circuit breaker
- Stops calling a failing dependency after an error threshold, failing fast for a cool-off period before probing again (Resilience4j in the Spring world). It prevents slow downstream calls from exhausting your threads; pair it with timeouts and fallbacks. See also: BackpressureRate limitingThread pool
- Circular dependency
- Bean A needs B and B needs A, which constructor injection cannot satisfy; Spring Boot 2.6+ fails at startup rather than hiding it. Fix the design by extracting a third component or an event, not by enabling
allow-circular-references. See also: DI (Dependency Injection)BeanIoC (Inversion of Control) - ClassLoader
- The component that finds
.classfiles and defines classes in the JVM, arranged in a parent-delegation hierarchy. The same class loaded by two loaders is two different types, which causes bafflingClassCastExceptions in app servers and plugin systems. See also: BytecodeMetaspaceProxy - Connection pool
- A reusable set of open database connections, HikariCP in Spring Boot by default. Size it small (often 10-20 per instance) because the database, not your app, is the bottleneck, and remember that instances multiplied by pool size must stay under the DB connection limit. See also: Thread poolBackpressureORM (Object-Relational Mapping)
- Consistent hashing
- Maps keys and nodes onto a ring so that adding or removing a node only moves a small fraction of keys, unlike
hash % Nwhich remaps almost everything. Used by distributed caches and partitioned stores, usually with virtual nodes for even load. See also: ShardingCache-asideReplication lag - CORS
- A browser mechanism where a server declares which other origins may call it from JavaScript, through
Access-Control-Allow-*headers. It protects browsers only, not the server, andallowedOrigins("*")combined with credentials is not allowed. See also: CSRF (Cross-Site Request Forgery)API gatewayJWT (JSON Web Token) - Covering index
- An index that contains every column a query needs, so the database answers from the index alone without touching the table (an index-only scan). Add trailing columns with
INCLUDE(PostgreSQL) for hot read queries, but each extra column slows writes. See also: Database indexN+1 query problemORM (Object-Relational Mapping) - CQRS
- Command Query Responsibility Segregation: use separate models (and often stores) for writes and reads, so each is optimised independently. It adds sync complexity and eventual consistency, so use it only where read and write needs truly diverge. See also: Event sourcingEventual consistencyReplication lag
- CSRF (Cross-Site Request Forgery)
- A malicious site makes the victim's browser send an authenticated request using its cookies. Spring Security enables CSRF tokens by default for session-based apps; it can be disabled for stateless APIs that use bearer tokens in a header, not cookies. See also: CORSJWT (JSON Web Token)OAuth 2.0
- Database deadlock
- Two transactions each hold row locks the other needs, and the database aborts one with a deadlock error. Update rows in a consistent order, keep transactions short, and be ready to retry the victim. See also: DeadlockPessimistic lockingIsolation level
- Database index
- A sorted structure (usually a B-tree) that lets the database find rows without scanning the table, at the cost of slower writes and extra storage. Column order in a composite index matters, and wrapping a column in a function in the
WHEREclause usually defeats it; check withEXPLAIN. See also: Covering indexORM (Object-Relational Mapping)Schema migration - Deadlock
- Two or more threads each hold a lock the other needs, so none ever proceeds. Acquire locks in a consistent global order and take a
jstackthread dump, which reports detected deadlocks explicitly. See also: Race conditionDatabase deadlockThread pool - DI (Dependency Injection)
- Supplying an object's collaborators from outside, usually through the constructor. Prefer constructor injection: dependencies become
final, required and testable without Spring, and field@Autowiredhides them. See also: IoC (Inversion of Control)BeanCircular dependency - Dirty checking
- Hibernate snapshots managed entities and, at flush time, automatically issues
UPDATEs for any that changed, so no explicit save is needed inside a transaction. The surprise: mutating a loaded entity for display purposes persists the change. See also: First-level cacheORM (Object-Relational Mapping)@Transactional propagation - DLQ (dead-letter queue)
- A side queue where messages land after repeated processing failures, so one poison message does not block the stream. Monitor and alert on its depth, and keep enough context to replay messages after the bug is fixed. See also: At-least-once deliveryIdempotency keyBackpressure
- Escape analysis
- A JIT optimisation that proves an object never leaves a method or thread, so it can be allocated on the stack or eliminated entirely (scalar replacement) and its locks removed. It is why small short-lived objects are cheaper than they look, but it silently stops working once the object is stored in a field or passed to code that is not inlined. See also: JIT compiler (just-in-time)HeapImmutable object
- Event sourcing
- Store an append-only log of state-changing events and derive current state by replaying them, which gives a full audit trail and time travel. The costs are event schema versioning, snapshots for long streams and eventual-consistent read models. See also: CQRSEventual consistencyTransactional outbox
- Eventual consistency
- Replicas or services may disagree briefly but converge if updates stop. Design the UI and APIs for it, for example read-your-own-writes from the primary right after a write. See also: CAP theoremReplication lagSaga
- Exactly-once processing
- Each message has its effect precisely once. In practice it is at-least-once delivery plus idempotent handling or transactional writes (Kafka transactions work only within Kafka), not a magic broker property. See also: At-least-once deliveryIdempotency keyTransactional outbox
- First-level cache
- The per-session (persistence context) identity map: loading the same id twice in one transaction returns the same instance without a second query. It is not shared across requests, and it grows unbounded in big batch jobs unless you
flush()andclear(). See also: Dirty checkingN+1 query problemORM (Object-Relational Mapping) - G1 (Garbage-First collector)
- The default GC since Java 9. It splits the heap into regions and collects the most garbage-filled ones first, aiming for a pause target set by
-XX:MaxGCPauseMillis. A good general-purpose choice; huge allocations (humongous objects) are its classic gotcha. See also: ZGCStop-the-world (STW)Heap - Graceful shutdown
- On SIGTERM, stop accepting new requests, finish in-flight ones, then exit. Enable with
server.shutdown=gracefuland alignspring.lifecycle.timeout-per-shutdown-phasewith the KubernetesterminationGracePeriodSeconds. See also: Liveness vs readinessBlue/green deploymentThread pool - Happens-before
- The Java Memory Model rule that guarantees writes by one action are visible to another, for example unlocking a monitor before a later lock of it, or a
volatilewrite before a later read. Without a happens-before edge, a thread may legally see stale or reordered data. See also: Memory visibilityvolatileRace condition - Heap
- The JVM memory region where all objects live, sized with
-Xms/-Xmxand cleaned by the garbage collector. In containers, set-XX:MaxRAMPercentageso the heap leaves room for metaspace, thread stacks and native buffers, or the kernel OOM-kills the pod. See also: MetaspaceG1 (Garbage-First collector)OutOfMemoryError (OOM) - HMAC
- A keyed hash that proves a message came from someone holding the shared secret and was not altered, used for webhook signatures and HS256 JWTs. Compare signatures with a constant-time check such as
MessageDigest.isEqual, notequals. See also: JWT (JSON Web Token)BCryptOAuth 2.0 - Idempotency key
- A client-generated unique id sent with a request (commonly an
Idempotency-Keyheader) so the server can recognise a retry and return the original result instead of repeating the effect. Store the key with a unique constraint, so a retried payment charges once. See also: At-least-once deliveryExactly-once processingTransactional outbox - Immutable object
- An object whose state cannot change after construction (all fields
final, no mutators), so it can be shared across threads with no locking. Javarecordtypes are the easiest way to model DTOs and value objects this way. See also: Race conditionMemory visibilityThreadLocal - IoC (Inversion of Control)
- The framework, not your code, creates objects and wires them together and controls their lifecycle. In Spring this is the
ApplicationContext, which makes components easy to replace and test. See also: DI (Dependency Injection)BeanAuto-configuration - Isolation level
- How much concurrent transactions can see of each other: read committed, repeatable read, serializable. PostgreSQL defaults to read committed and MySQL InnoDB to repeatable read, so identical code can behave differently across databases. See also: MVCC (Multi-Version Concurrency Control)Phantom readOptimistic locking
- JIT compiler (just-in-time)
- The JVM starts by interpreting bytecode, then compiles hot methods to optimised machine code at run time (C1, then C2). It explains why Java benchmarks need warm-up and why the first requests after a deploy are slower. See also: BytecodeEscape analysisClassLoader
- JWT (JSON Web Token)
- A signed token carrying claims (
sub,exp, roles) that servers verify without a session lookup. The payload is only base64-encoded, not encrypted, so never put secrets in it; keep lifetimes short, since a stateless token cannot be revoked beforeexp. See also: OAuth 2.0HMACRBAC (Role-Based Access Control) - Lazy loading
- Associations are fetched only when first accessed, through a proxy. Touching them after the session closes throws
LazyInitializationException; the answer is to fetch what you need in the query, not to enable open-session-in-view. See also: N+1 query problemFirst-level cacheORM (Object-Relational Mapping) - Liveness vs readiness
- Liveness answers whether the process is stuck and should be restarted; readiness answers whether it can take traffic right now. Do not put database checks in liveness, or a DB outage restarts every pod; Spring Boot exposes
/actuator/health/livenessand/readiness. See also: ActuatorGraceful shutdownService discovery - Memory visibility
- The question of when one thread's write becomes observable by another; CPU caches and compiler reordering mean it is not automatic. A plain
boolean stopflag read in a loop may never be seen as changed unless it isvolatileor guarded by a lock. See also: Happens-beforevolatileRace condition - Metaspace
- Native (off-heap) memory holding class metadata, replacing PermGen since Java 8. It grows until the OS limit by default, so a classloader leak (for example repeated hot redeploys) shows up as
OutOfMemoryError: Metaspace; cap it with-XX:MaxMetaspaceSize. See also: ClassLoaderHeapOutOfMemoryError (OOM) - Multi-stage build
- A Dockerfile with several
FROMstages, building with a full JDK in one and copying only the jar into a slim JRE image in the last. It shrinks images and attack surface; use Spring Boot layered jars so dependency layers stay cached. See also: 12-factor appBlue/green deploymentJIT compiler (just-in-time) - MVCC (Multi-Version Concurrency Control)
- The database keeps multiple row versions so readers see a consistent snapshot without blocking writers. The cost is old versions that must be vacuumed or purged, so very long-running transactions bloat storage. See also: Isolation levelPhantom readPessimistic locking
- N+1 query problem
- Loading N parent rows and then issuing one extra query per parent to fetch a lazy association, giving N+1 round trips. Fix it with
JOIN FETCH, an@EntityGraphor batch fetching, and catch it by logging SQL statement counts in tests. See also: Lazy loadingORM (Object-Relational Mapping)First-level cache - OAuth 2.0
- A framework for delegated authorisation: a client obtains an access token from an authorisation server to call a resource server. Use the authorization code flow with PKCE for user logins and never the deprecated implicit flow; OpenID Connect adds identity on top. See also: JWT (JSON Web Token)RBAC (Role-Based Access Control)CSRF (Cross-Site Request Forgery)
- Observability
- The ability to understand internal behaviour from outputs: metrics, logs and traces. In Spring Boot 3 use Micrometer plus OpenTelemetry tracing, and propagate a trace id through logs so one request can be followed across services. See also: Structured loggingSLO (Service Level Objective)Actuator
- Optimistic locking
- Detects concurrent edits by comparing a
@Versioncolumn on update and failing withOptimisticLockExceptionif it changed. No DB locks are held, so it scales well when conflicts are rare; handle the exception with a retry or a user-facing message. See also: Pessimistic lockingIsolation levelRace condition - ORM (Object-Relational Mapping)
- Maps tables to objects so you work with entities rather than SQL; JPA is the spec and Hibernate 6 the implementation. Convenient for CRUD, but it hides queries, so always inspect the generated SQL for hot paths. See also: N+1 query problemDirty checkingLazy loading
- OutOfMemoryError (OOM)
- Thrown when the JVM cannot allocate: heap exhausted, metaspace full, or unable to create a native thread. Always run production with
-XX:+HeapDumpOnOutOfMemoryErrorso you can find the leak afterwards; do not just raise-Xmx. See also: HeapMetaspaceThread pool - Pessimistic locking
- Takes a database row lock up front (
SELECT ... FOR UPDATE,LockModeType.PESSIMISTIC_WRITE) so others wait. Use it for high-contention rows like stock counters, keep the transaction short, and set a lock timeout to avoid pile-ups. See also: Optimistic lockingDatabase deadlockIsolation level - Phantom read
- Re-running a range query in the same transaction returns new rows inserted and committed by someone else. Only serializable (or gap locks in MySQL) fully prevents it, which matters for checks like 'no overlapping bookings'. See also: Isolation levelMVCC (Multi-Version Concurrency Control)Pessimistic locking
- Profile
- A named configuration slice (
dev,prod) activated withspring.profiles.activeto switch beans and properties per environment. Keep secrets out of profile files and prefer environment variables so the same artifact runs everywhere. See also: 12-factor appAuto-configurationBean - Proxy
- A generated wrapper around a bean that intercepts calls to add behaviour such as transactions, caching or security (JDK dynamic proxy or CGLIB subclass). Gotcha: a self-invocation (
this.other()) skips the proxy, so@Transactionalon that inner call is silently ignored. See also: AOP (Aspect-Oriented Programming)@Transactional propagationBean - Race condition
- A bug where the result depends on the timing of unsynchronised threads, such as check-then-act on a shared
HashMap. Fix by confining state, using immutable objects, or using atomics, locks or concurrent collections. See also: Happens-beforeImmutable objectCAS (compare-and-swap) - Rate limiting
- Capping how many requests a client may make in a time window to protect services from abuse and overload, responding with HTTP 429 and
Retry-After. Apply at the gateway for coarse limits and per-user in the app, backed by a shared store like Redis when running multiple instances. See also: Token bucketAPI gatewayBackpressure - RBAC (Role-Based Access Control)
- Permissions are granted to roles and roles to users, enforced in Spring with
@PreAuthorize("hasRole('ADMIN')")or URL rules. Enforce on the server for every request, and check object ownership too, otherwise users can read each other's records by changing an id. See also: JWT (JSON Web Token)OAuth 2.0AOP (Aspect-Oriented Programming) - Replication lag
- The delay before a write on the primary appears on a read replica. Reading from a replica right after writing can return stale data, so route such reads to the primary or use session stickiness. See also: Eventual consistencyCAP theoremSharding
- Saga
- A way to keep data consistent across services without a distributed transaction: a sequence of local transactions, each with a compensating action to undo it on failure. Coordinate by choreography (events) or orchestration (a central coordinator). See also: Transactional outboxEventual consistencyIdempotency key
- Schema migration
- Versioned, ordered scripts (Flyway, Liquibase) that evolve the database schema alongside code. Never rely on
ddl-auto=updatein production, and make changes backward compatible (expand, then contract) so old and new app versions can run together during a rollout. See also: Database indexBlue/green deploymentORM (Object-Relational Mapping) - Service discovery
- How services find the current network addresses of each other as instances come and go, via a registry (Eureka, Consul) or the platform itself (Kubernetes DNS and Services). On Kubernetes, use plain Service names and skip a separate registry. See also: API gatewayLiveness vs readinessCircuit breaker
- Sharding
- Splitting data horizontally across databases by a shard key. A poor key creates hot shards, and cross-shard joins and transactions become hard, so exhaust indexing, caching and read replicas first. See also: Consistent hashingReplication lagCAP theorem
- SLO (Service Level Objective)
- A target for a measured indicator, such as 99.9% of requests under 300 ms over 30 days; the gap to 100% is your error budget. Alert on budget burn rate rather than on every spike. See also: ObservabilityCanary releaseCircuit breaker
- Starter
- A dependency descriptor such as
spring-boot-starter-webthat pulls in a curated, version-aligned set of libraries and triggers their auto-configuration. Align versions through the Boot BOM rather than pinning individual transitive versions. See also: Auto-configurationBeanActuator - Stop-the-world (STW)
- A pause during which the JVM halts all application threads, for example for GC phases or safepoint operations. Long STW pauses appear as latency spikes and failed health checks; read them from the GC log (
-Xlog:gc*). See also: G1 (Garbage-First collector)ZGCHeap - Structured logging
- Emitting logs as machine-parseable JSON with fields (
traceId,userId,level) instead of free text. Spring Boot 3.4 supports it natively; never log secrets or full request bodies. See also: Observability12-factor appThreadLocal - Thread pool
- A fixed set of reusable worker threads fed by a queue (
ExecutorService). An unbounded queue hides overload until you run out of memory, and a pool that blocks on tasks it submitted to itself can starve into deadlock; always bound both. See also: Virtual threadBackpressureDeadlock - ThreadLocal
- Gives each thread its own copy of a variable, often used to carry a request context or user. In thread pools you must
remove()it or values leak into the next request; with virtual threads prefer scoped values or explicit parameters. See also: Thread poolVirtual threadMemory visibility - Token bucket
- A rate-limiting algorithm: tokens refill at a steady rate into a bucket of fixed capacity and each request spends one. It allows short bursts up to the bucket size while enforcing the long-run average; Bucket4j implements it for Java. See also: Rate limitingAPI gatewayBackpressure
- Transactional outbox
- Write the business change and an event row in the same local database transaction, then have a relay (poller or CDC such as Debezium) publish it. This avoids the dual-write bug where the DB commits but the message broker call fails. See also: At-least-once deliverySagaIdempotency key
- TTL (time to live)
- How long a cached entry, token or record stays valid before it expires. Add random jitter so many keys written together do not expire together, and pick it from how stale a value can safely be. See also: Cache-asideCache stampedeJWT (JSON Web Token)
- Virtual thread
- A lightweight JVM-scheduled thread (final in Java 21) that lets you write blocking code and still serve hundreds of thousands of concurrent tasks. Enable in Spring Boot 3.2+ with
spring.threads.virtual.enabled=true; avoid pinning by longsynchronizedblocks around blocking I/O and do not pool them. See also: Thread poolThreadLocalDeadlock - volatile
- A field modifier that makes writes immediately visible to other threads and forbids reordering around the access. It does not make compound actions atomic:
count++on a volatile int is still a race. See also: Memory visibilityHappens-beforeCAS (compare-and-swap) - Write-through cache
- Writes go to the cache and the backing store together, so reads from the cache are never stale from your own writes. It costs write latency and caches data that may never be read. See also: Cache-asideTTL (time to live)Cache stampede
- ZGC
- A low-latency collector that does almost all work concurrently, keeping pauses well under a millisecond even on multi-terabyte heaps. Enable with
-XX:+UseZGC(generational by default in recent JDKs) when tail latency matters more than raw throughput. See also: G1 (Garbage-First collector)Stop-the-world (STW)Heap