Java and Spring
- Java and Spring5 min read
Build a REST API with Spring Boot
Build a complete REST API with Spring Boot step by step: a task resource with create, read, update and delete, request and response records, validation, proper status codes, consistent error responses with ProblemDetail, pagination, PostgreSQL with Flyway, and tests.
- Java and Spring6 min read
How the JVM runs your code
Follow a Java program from source to running machine code: compiling to bytecode, class files, class loading and the class loader hierarchy, bytecode verification, the interpreter and JIT compilers with tiered compilation, memory areas, garbage collection, and tools to look inside, plus how this explains warm-up and startup time.
- Java and Spring5 min read
Java collections
A map of the Java Collections Framework: List, Set, Map, Queue and Deque, the main implementations and their costs, which to choose for which job, sorting and iterating, immutable collections, and the mistakes that cause bugs.
- Java and Spring4 min read
Java streams
Process collections declaratively with the Stream API: creating streams, filter, map and sorted, collecting to lists, maps and groups, reducing, primitive streams, Optional results, laziness, and the mistakes that make streams slow or wrong.
- Java and Spring4 min read
JDK vs JRE vs JVM
The three parts of Java that everyone mixes up: what the JVM does with bytecode, what the JRE added around it, what the JDK contains for developers, why the standalone JRE disappeared, and which one to install.
- Java and Spring5 min read
JPA and Hibernate
How JPA and Hibernate map Java objects to database tables: entities and annotations, the persistence context and dirty checking, relationships, lazy and eager loading, the N+1 query problem and its fixes, Spring Data repositories, transactions, and the common pitfalls.
- Java and Spring5 min read
Maven vs Gradle
Java's two build tools compared: what a build tool does, Maven's pom.xml and lifecycle, Gradle's Kotlin and Groovy build scripts and task graph, dependency management and scopes, wrappers, multi-module projects, speed and caching, and how to choose.
- Java and Spring5 min read
Multithreading in Java
A practical tour of Java's concurrency toolkit: executors and thread pools, Callable and Future, CompletableFuture pipelines, concurrent collections, locks and atomics, CountDownLatch and Semaphore, parallel streams, virtual threads and structured concurrency, and how Spring's @Async fits in.
- Java and Spring3 min read
Optional in Java
Use Optional to make "there may be no value" explicit instead of returning null: creating Optionals, orElse vs orElseGet, map and flatMap, ifPresentOrElse, where Optional belongs and where it does not, and the anti-patterns to avoid.
- Java and Spring5 min read
Records in Java
Java records explained: concise immutable data carriers with generated constructors, accessors, equals, hashCode and toString, compact constructors for validation, adding methods, static factories, records with generics and interfaces, pattern matching and record patterns, and where records fit with JPA, Jackson and Spring.
- Java and Spring5 min read
Spring Boot for beginners
Build your first Spring Boot application: what Spring and Spring Boot add, creating a project with Spring Initializr, a REST controller, dependency injection with services, configuration in application.yml, saving data with Spring Data JPA, testing and packaging.
- Java and Spring5 min read
Spring Security explained
How Spring Security works and how to configure it: the filter chain, authentication versus authorisation, a SecurityFilterChain for a REST API, users and password encoding, method security, JWT resource servers, CSRF and CORS, and testing secured endpoints.
- Java and Spring5 min read
Testing with JUnit
Write good tests in Java with JUnit 5: setting up with Maven or Gradle, test structure and assertions, AssertJ, lifecycle methods, parameterised tests, testing exceptions, nested and display names, mocking with Mockito, Spring Boot test slices, Testcontainers for real databases, and habits that keep tests valuable.
- Java and Spring6 min read
The Java memory model
What the Java memory model guarantees when threads share data: why reordering and CPU caches break naive code, the happens-before relationship, volatile, synchronized, final fields and safe publication, atomic classes, the double-checked locking trap, and practical rules for correct concurrent code.
- Java and Spring6 min read
Virtual threads
Java's virtual threads in depth: why platform threads limit servers, how virtual threads mount and unmount on carrier threads, creating them, what they speed up and what they do not, pinning and how Java 24 reduced it, ThreadLocal and pooling pitfalls, limiting concurrency, and using them in Spring Boot.