Skip to main content

204 docs tagged with "intermediate"

View all tags

Abstract Factory Pattern

A creational pattern that produces families of related objects without specifying their concrete classes.

Abstraction

Hide complexity behind a clean contract — when to use abstract classes vs. interfaces, default methods, and the design forces that govern the choice.

Adapter Pattern — Practical Demo

Hands-on examples of the Adapter pattern — wrapping incompatible APIs, integrating third-party SDKs, and using Spring DI as an adapter.

API Contract

The single REST endpoint, full request and response shapes, Bean Validation rules, and what happens when validation fails.

API Design

Principles and patterns for designing clear, versioned, and client-friendly REST, gRPC, and GraphQL APIs in Java/Spring Boot services.

API Design — Practical Demo

Scenario-based walkthrough of designing a production-quality REST API with versioning, pagination, error handling, and rate-limiting headers in Spring Boot 3.

Application Properties & Configuration

How Spring Boot externalizes configuration using application.properties/yml, profiles, @Value, and @ConfigurationProperties for structured, type-safe config binding.

Atomic Variables

Lock-free thread-safe operations using AtomicInteger, AtomicReference, LongAdder, and the compare-and-swap (CAS) CPU primitive that powers them.

Authentication — Practical Demo

Hands-on code examples for Spring Security authentication — UserDetailsService, BCrypt, custom login endpoint, and accessing the current user.

Authorization — Practical Demo

Hands-on examples for Spring Security authorization — URL rules, @PreAuthorize, SpEL expressions, ownership checks, and testing access control.

Bean Lifecycle

The complete lifecycle of a Spring bean — from instantiation and dependency injection, through initialization callbacks, to destruction — and how to hook into each stage.

Bean Scopes

How Spring's bean scopes — singleton, prototype, request, session, and application — control when beans are created, how many instances exist, and how they interact with each other.

Branching Strategies

A comparison of Git Flow, GitHub Flow, and trunk-based development — what each model is, when to use it, and how it shapes your CI/CD pipeline.

Builder Pattern

A creational pattern that separates the construction of a complex object from its representation, allowing the same construction process to produce different results.

Caching Strategies

Patterns for caching application data — cache-aside, write-through, write-behind — eviction policies, TTL design, and cache stampede prevention in Spring Boot with Redis.

Caching Strategies — Practical Demo

Scenario-based walkthrough of implementing cache-aside with Redis in Spring Boot — including TTL configuration, cache eviction, and stampede prevention.

Chain of Responsibility Pattern

A behavioral pattern that passes a request along a chain of handlers, each deciding to process it or pass it to the next handler.

Class Loading

How the JVM loads, links, and initializes classes on demand — the parent-delegation model, the three standard classloaders, and how frameworks use custom classloaders for isolation and hot reload.

Collections Framework Interview Questions

Consolidated interview Q&A for the Java Collections Framework — hierarchy, List, Set, Map, Queue, iterators, sorting, and immutability — from beginner through advanced.

Collections Framework Overview

Quick-reference summary of the Java Collections Framework — hierarchy, implementations, complexity, and top interview questions.

Collections Hierarchy

The complete interface tree of the Java Collections Framework — Iterable, Collection, List, Set, Queue, and why Map stands apart.

Collectors

Java's built-in Collector implementations — toList, groupingBy, partitioningBy, joining, toMap, counting, and how to build custom collectors.

Command Pattern

A behavioral pattern that encapsulates a request as an object, enabling undo/redo, queuing, logging, and parameterization of operations.

Composite Pattern

A structural pattern that composes objects into tree structures to represent part-whole hierarchies, letting clients treat individual objects and compositions uniformly.

Conflict Resolution

How Git detects and marks merge conflicts, what three-way merge means, how to resolve conflicts efficiently with rerere and merge tools, and strategies to avoid them in the first place.

Connection Pooling & HikariCP

Why connection pooling is essential, how HikariCP works, and how to configure it correctly in Spring Boot applications.

Core APIs Overview

Quick-reference summary of Java's core utility classes — Object, String, StringBuilder, Math, wrapper types, and Optional — with a learning path and top interview questions.

Core Java Interview Questions

Consolidated interview Q&A for Core Java covering beginner through advanced topics — variables, types, operators, control flow, arrays, strings, methods, and packages.

CSRF and CORS — Practical Demo

Hands-on examples for CSRF protection and CORS configuration in Spring Boot — Cookie-based CSRF for SPAs, production CORS setup, fixing the preflight 401 problem, and testing with MockMvc.

CSRF and CORS in Spring Security

How Spring Security prevents Cross-Site Request Forgery attacks with CSRF tokens, when to disable CSRF for REST APIs, and how to configure CORS for Single-Page Applications talking to Spring Boot backends.

Custom Exceptions

How to create domain-specific exception classes in Java — checked vs. unchecked choice, adding context fields, exception chaining, and hierarchy design.

Custom Exceptions — Practical Demo

Hands-on examples for building domain-specific exception hierarchies, adding typed fields, chaining exceptions, and integrating with Spring Boot's @ControllerAdvice.

Databases Overview

Quick-reference summary of SQL, indexes, transactions, connection pooling, NoSQL trade-offs, and schema migration for Java backend engineers.

Decorator Pattern

A structural pattern that dynamically adds behavior to an object by wrapping it in decorator objects, without altering the original class.

Dependency Injection

How Spring's container wires beans together using constructor, setter, and field injection, and when to use @Autowired, @Qualifier, and @Primary.

Domain Model

The entities, DTOs (Java Records), and enums that represent the core concepts of a loan application — and why each was designed the way it was.

Exception Best Practices

Production-proven rules for when to throw, catch, wrap, and log exceptions in Java — covering the checked vs. unchecked debate, layered architecture patterns, and common anti-patterns.

Exception Handling

How GlobalExceptionHandler uses @RestControllerAdvice to intercept validation failures and unexpected errors and convert them into structured JSON responses.

Exception Handling — Practical Demo

Hands-on Spring Boot demo of @ControllerAdvice, ProblemDetail error responses, validation error shaping, and the catch-all exception handler pattern.

Exception Handling in Spring MVC

How to centralise HTTP error responses in Spring Boot — @ExceptionHandler, @ControllerAdvice, ProblemDetail (RFC 7807), and mapping domain exceptions to the right status codes.

Exceptions Interview Questions

Consolidated interview Q&A for Java Exceptions — hierarchy, try/catch/finally, custom exceptions, and best practices from beginner through advanced.

Exceptions Overview

Quick-reference summary of Java exception handling — hierarchy, try/catch/finally, custom exceptions, and best practices — for rapid revision.

Factory Method Pattern

A creational pattern that defines an interface for creating an object but lets subclasses decide which class to instantiate.

Functional Interfaces

What functional interfaces are, the built-in types (Function, Predicate, Consumer, Supplier), and how to compose them.

Functional Programming Overview

Quick-reference summary of Java 8+ functional programming — lambdas, functional interfaces, method references, Streams, Collectors, parallel streams, and Optional — for rapid revision.

Garbage Collection

How the JVM automatically reclaims heap memory — GC roots, reachability analysis, generational collection, and the major collectors (Serial, Parallel, G1, ZGC) with tuning flags.

Generics

How Java generics provide compile-time type safety through parameterised types — covering generic classes, generic methods, bounded type parameters, and the key constraint that generics only work with reference types.

Generics — Practical Demo

Hands-on code examples for generic classes, generic methods, bounded type parameters, and the diamond operator.

Git Hooks and Workflows

How Git hooks let you automate quality checks at every stage of the commit and push lifecycle — pre-commit linting, commit-msg validation, pre-push tests, and managing hooks across a team with tools like pre-commit.

Hibernate Basics for Spring Boot Developers

The Hibernate internals every Spring Boot developer must understand — SessionFactory vs Session thread safety, entity states, dirty checking, first-level cache, second-level cache, and LazyInitializationException.

HTTP Fundamentals

A deep dive into the HTTP protocol — methods, status codes, headers, content negotiation, and HTTP/2 basics — as used in Java backend development.

Immutable Collections

How to create truly immutable List, Set, and Map instances in Java using the Java 9+ factory methods and how they differ from the older Collections.unmodifiable wrappers.

Indexes & Query Performance

How database indexes work, when to add them, how to read EXPLAIN plans, and common indexing pitfalls that hurt performance.

Inheritance

Extend classes with `extends`, override behavior with `@Override`, use `super` for parent delegation, and learn when inheritance causes more harm than good.

Integration Tests

How to use @SpringBootTest with TestRestTemplate and WebTestClient to write full-context Spring Boot integration tests.

Integration Tests — Practical Demo

Hands-on walkthrough of @SpringBootTest with TestRestTemplate, @MockBean for external dependencies, and Testcontainers for real database integration.

IoC Container

How Spring's Inversion of Control container manages bean definitions, wires dependencies, and controls object lifecycle using ApplicationContext and BeanFactory.

Java Design Patterns Overview

Quick-reference summary of all 15 GoF design patterns in Java — participants, intent, Java/Spring examples, and top interview questions.

Java Type System Overview

Quick-reference summary of Java's type system — primitives, autoboxing, generics, wildcards, type erasure, and type inference — for rapid revision before interviews.

java.util.concurrent

The high-level concurrency toolkit — ExecutorService, Future, CompletableFuture, CountDownLatch, CyclicBarrier, and Semaphore — that replaces manual thread management in production Java.

JPA Basics — Entity Mapping and Relationships

How to map Java classes to database tables using @Entity, @Id, @GeneratedValue, and relationship annotations (@OneToMany, @ManyToOne), including fetch type defaults and their implications.

JPA Basics — Practical Demo

Hands-on code examples for JPA entity mapping, relationships, fetch types, and Spring Data auditing in a simple e-commerce domain.

JVM Memory Model (Runtime Data Areas)

The JVM's runtime memory layout — heap regions, stack frames, Metaspace, and per-thread vs. shared areas — and why understanding it matters for diagnosing OutOfMemoryErrors and tuning performance.

JWT Authentication — Practical Demo

Hands-on examples for JWT authentication in Spring Boot — generating tokens, validating with Spring Security's resource server, custom claims, and refresh token pattern.

JWT Authentication in Spring Security

JSON Web Token structure, signing (symmetric vs. asymmetric), validation, and how to wire stateless JWT authentication into a Spring Boot REST API using Spring Security's OAuth2 Resource Server support.

Lambdas

Lambda expressions in Java — syntax, effectively-final capture, `this` behavior, and how they relate to functional interfaces.

List — ArrayList vs LinkedList

Understand Java's List interface, when to use ArrayList vs LinkedList, and how their internal structures drive performance trade-offs.

List — Practical Demo

Hands-on examples for ArrayList vs LinkedList, pre-sizing, safe removal, and subList behavior.

Locks

Explicit locking with ReentrantLock, ReadWriteLock, and StampedLock — when and why to reach for them over synchronized.

Locks — Practical Demo

Hands-on walkthroughs of ReentrantLock, ReadWriteLock, tryLock with timeout, and Condition-based signaling.

Method References

The four kinds of method references in Java — static, bound instance, unbound instance, and constructor — and when to prefer them over lambdas.

Microservices

An architectural style that structures an application as a collection of small, independently deployable services — each owning its data and business logic.

Microservices — Practical Demo

Scenario-based walkthrough of building a two-service Order + Inventory microservices topology with service discovery, Kafka events, and Spring Boot 3.

Mockito

How to create mock objects, stub method calls, verify interactions, and capture arguments in Java unit tests.

Mockito — Practical Demo

Hands-on code examples for creating mocks, stubbing behavior, verifying interactions, and capturing arguments with Mockito.

MockMvc & WebTestClient

How to test Spring MVC and Spring WebFlux controllers at the HTTP level without starting a real server, using MockMvc and WebTestClient.

Multithreading & Concurrency Interview Questions

Consolidated interview Q&A for Java Multithreading — threads, synchronization, wait/notify, ExecutorService, locks, atomics, thread safety, and virtual threads from beginner through advanced.

Multithreading & Concurrency Overview

Quick-reference summary of Java concurrency — threads, synchronization, locks, atomics, ExecutorService, CompletableFuture, virtual threads — for rapid revision.

MySQL, PostgreSQL & H2 — Database Guide

Practical guide to MySQL, PostgreSQL, and H2 for Java developers — architecture differences, UUID handling, H2 for development, and migration paths to production databases.

NoSQL Trade-offs

CAP theorem, BASE properties, and when to choose Redis, MongoDB, Cassandra, or Elasticsearch over a relational database.

Object Class

The root of every Java class hierarchy — toString, equals, hashCode, clone, wait, notify, and finalize explained with contracts and pitfalls.

Observer Pattern

A behavioral pattern where an object (subject) maintains a list of dependents (observers) and notifies them automatically when its state changes.

OOP Overview

Quick-reference summary of Java OOP concepts — classes, encapsulation, inheritance, polymorphism, abstraction, records, and sealed classes.

OpenAPI & Springdoc

Auto-generating interactive API documentation for Spring Boot REST APIs using springdoc-openapi — setup, @Operation/@Schema annotations, security schemes, and customisation.

Optional — Practical Demo

Hands-on examples for Optional creation, chained transformations, orElseGet laziness, and common anti-patterns.

Optional (Java 8+)

Java's Optional container type — what it is, when it genuinely clarifies code, and the common anti-patterns that make it worse than a null check.

Optional Deep Dive

How to use Optional correctly — creation, retrieval patterns, chaining, and the anti-patterns that make Optional worse than null.

Persistence Layer

How LoanApplication is mapped to H2 using JPA @Embeddable value objects, @ElementCollection for rejection reasons, and @PrePersist for UUID generation.

Polymorphism

Compile-time (overloading) vs. runtime (overriding) dispatch — how Java decides which method to call and why this is the foundation of flexible design.

Primitives vs. Objects

How Java's eight primitive types differ from object references — stack vs. heap, null safety, autoboxing, unboxing, and the performance tradeoffs involved.

Prototype Pattern

A creational pattern that creates new objects by copying (cloning) an existing instance rather than instantiating from scratch.

Proxy Pattern

A structural pattern that provides a surrogate object which controls access to another object, adding security, caching, logging, or lazy initialization transparently.

Proxy Pattern — Practical Demo

Hands-on examples showing manual proxies, JDK dynamic proxies, and how Spring AOP uses proxies for @Transactional and @Cacheable.

Rebase vs. Merge

The difference between git merge and git rebase — when each produces a better history, how interactive rebase cleans up commits, and the golden rule you must never break.

Records (Java 16+)

Java's concise immutable data carrier — understand what records generate automatically, compact constructors, and when records replace traditional value classes.

Reliability Patterns

Circuit Breaker, Retry, Bulkhead, Timeout, and Rate Limiter — the five resilience patterns that prevent cascading failures in distributed Spring Boot services, implemented with Resilience4j.

REST Design

How to design clean, coherent REST APIs — resource naming, HTTP verb mapping, versioning strategies, HATEOAS, and idempotency patterns used in production Spring Boot services.

Service & Business Logic

How the LoanApplicationService evaluates a loan — risk classification, interest rate calculation, EMI formula, and the two-tier eligibility check — step by step.

Set — Practical Demo

Hands-on examples for HashSet, LinkedHashSet, and TreeSet — uniqueness enforcement, ordering differences, and set operations.

Singleton Pattern

A creational pattern that ensures a class has exactly one instance and provides a global access point to it.

SOLID Principles

Five design principles that make object-oriented code easier to maintain, extend, and test — the foundation of clean Java design.

Sorting and Ordering — Comparable vs Comparator

Understand the difference between Comparable (natural ordering defined on the class) and Comparator (external ordering strategy), and how to use both with collections, streams, and sorted data structures.

Spring AOP

How Spring's Aspect-Oriented Programming model applies cross-cutting concerns — logging, transactions, security, caching — using proxies, pointcuts, and advice without touching business logic.

Spring Boot Actuator

Spring Boot Actuator exposes built-in HTTP/JMX endpoints for health checks, metrics, environment inspection, and live bean graphs — essential for production monitoring and operations.

Spring Boot Auto-Configuration

How Spring Boot uses @EnableAutoConfiguration and @ConditionalOn* annotations to wire beans automatically based on what is on the classpath.

Spring Boot Overview

Quick-reference summary of Spring Boot auto-configuration, properties, starters, Actuator, and testing — key concepts, annotations, and interview questions at a glance.

Spring Boot Test Slices

How to use @WebMvcTest, @DataJpaTest, and @JsonTest to write fast, focused Spring Boot tests that load only the layers you need.

Spring Boot Testing

How to test Spring Boot applications using @SpringBootTest, test slices (@WebMvcTest, @DataJpaTest), @MockBean, and Testcontainers for integration tests with real infrastructure.

Spring Data Caching

How Spring's cache abstraction works with @Cacheable, @CacheEvict, @CachePut, and @Caching, plus integrating Caffeine and Redis as backing stores.

Spring Data Overview

Quick-reference summary of Spring Data JPA — entity mapping, repository methods, transactions, N+1, projections, and caching.

Spring Data Projections

How to use interface projections, DTO projections, and dynamic projections in Spring Data JPA to select only the columns you need in a single optimized query.

Spring Data Repositories

How Spring Data JPA's repository interfaces (CrudRepository, JpaRepository) eliminate DAO boilerplate through query method derivation and @Query for JPQL and native SQL.

Spring Events

How Spring's ApplicationEventPublisher and @EventListener provide a decoupled, in-process observer pattern for reacting to application state changes — including async and transactional event variants.

Spring Framework Interview Questions

Consolidated interview Q&A for Spring Framework covering IoC container, dependency injection, bean lifecycle, bean scopes, AOP, and Spring Events — beginner through advanced.

Spring Framework Overview

Quick-reference summary of Spring Framework concepts — IoC container, dependency injection, bean lifecycle, scopes, AOP, and events — for rapid revision before interviews.

Spring MVC

How Spring MVC processes HTTP requests — DispatcherServlet, @RestController, request mapping, parameter binding, and ResponseEntity patterns used in everyday Spring Boot APIs.

Spring MVC — Practical Demo

Hands-on Spring MVC examples covering DispatcherServlet internals, parameter binding, validation, content negotiation, and interceptors.

Spring Security Authentication

How Spring Security authenticates users — UserDetailsService, PasswordEncoder, AuthenticationManager, and the authentication flow from credentials to SecurityContext.

Spring Security Authorization

How Spring Security enforces access control — URL-based rules with requestMatchers, method-level security with @PreAuthorize and @Secured, and the role vs. authority distinction.

Spring Security Filter Chain

How Spring Security's ordered chain of servlet filters intercepts every HTTP request and applies authentication and authorization before the request reaches your controller.

Spring Security Interview Questions

Consolidated interview Q&A for Spring Security covering filter chain, authentication, authorization, JWT, OAuth2, CSRF, and CORS — beginner through advanced.

Spring Security Overview

Quick-reference summary of Spring Security's filter chain, authentication, authorization, JWT, OAuth2, CSRF, and CORS — key concepts, annotations, and interview questions at a glance.

SQL Fundamentals

Core SQL syntax and concepts — SELECT, JOIN types, GROUP BY, window functions, and subqueries — with Spring Boot JDBC context.

State Pattern

A behavioral pattern that allows an object to change its behavior when its internal state changes, as if the object changed its class.

Strategy Pattern

A behavioral pattern that defines a family of algorithms, encapsulates each one, and makes them interchangeable at runtime without changing the client.

Streams API

How Java streams work — pipeline anatomy, lazy evaluation, intermediate vs. terminal operations, and common pitfalls.

Synchronization

How Java's synchronized keyword, intrinsic locks, volatile, and the happens-before relationship prevent race conditions in multithreaded programs.

Template Method Pattern

A behavioral pattern that defines the skeleton of an algorithm in a base class, deferring specific steps to subclasses without changing the overall structure.

Testcontainers

How to use Testcontainers to run real PostgreSQL, MySQL, Redis, and Kafka instances inside Docker containers during Java tests.

Testcontainers — Practical Demo

Hands-on examples for running PostgreSQL, Redis, and Kafka in Docker containers during tests, with Spring Boot 3.1+ @ServiceConnection.

Testing Overview

Quick-reference summary of Java testing concepts — JUnit 5, Mockito, Spring Boot test slices, integration tests, Testcontainers, MockMvc, and WebTestClient.

Testing Strategy

How LoanApplicationService is unit-tested with JUnit 5 and Mockito — covering risk classification, EMI calculation, and all eligibility rules using @Nested test classes.

The N+1 Query Problem

What causes N+1 queries in JPA/Hibernate, how to diagnose them, and how to fix them with JOIN FETCH, @EntityGraph, DTO projections, and batch fetching.

Thread Safety Patterns

Three design-level strategies for writing correct concurrent code — immutability, ThreadLocal confinement, and explicit object confinement — without reaching for locks.

Transactions — Practical Demo

Hands-on examples for @Transactional propagation, readOnly optimization, rollbackFor, the self-invocation trap, and programmatic transactions.

Transactions & ACID

Database transactions, the four ACID properties, isolation levels, and how deadlocks occur — with Spring @Transactional context.

Transactions and @Transactional

How Spring's @Transactional works under the hood with AOP proxies, propagation levels, isolation levels, readOnly optimization, rollback rules, and the self-invocation trap.

Type Erasure

How the Java compiler removes all generic type information before producing bytecode, why this design choice was made for backward compatibility, and what limitations it imposes at runtime.

Type Erasure — Practical Demo

Hands-on code examples demonstrating what you can and cannot do because of Java's type erasure — instanceof, new T(), overloading, and the super type token pattern.

Type Inference

How the Java compiler deduces types automatically — covering the diamond operator, generic method type inference, `var` (Java 10+), and lambda target typing — and where inference has limits.

Version Control Overview

Quick-reference summary of Git basics, object model internals, branching strategies, rebase vs. merge, remotes, conflict resolution, and hooks for Java backend engineers.

Wait / Notify

How Object.wait(), notify(), and notifyAll() coordinate threads using the intrinsic monitor — including the spurious wakeup rule and when to use each method.

Web & REST Overview

Quick-reference summary of HTTP fundamentals, REST design, Spring MVC, exception handling, WebFlux, and OpenAPI for Java backend engineers.

Wildcards

How Java's wildcard type arguments — `?`, `? extends T`, and `? super T` — express variance in generic APIs, and how the PECS rule guides correct usage.

Wildcards — Practical Demo

Hands-on code examples for unbounded wildcards, upper-bounded (? extends T), lower-bounded (? super T), and the PECS rule.

Wrapper Classes

Java's eight primitive wrapper types — Integer, Long, Double, and friends — covering autoboxing, caching traps, parsing, and when to use primitives vs objects.