
Spring MVC REST API Guide to Building Clean Endpoints
Build a clean Spring MVC REST API: records at the edge, validation, one error format, pagination, caching headers, security, testing and what to avoid.
Tag
223 posts

Build a clean Spring MVC REST API: records at the edge, validation, one error format, pagination, caching headers, security, testing and what to avoid.

A complete guide to the Hibernate second level cache: JCache setup, entity, collection and query caches, strategies, invalidation, clustering and measuring.

A complete guide to Kafka producer durability in Java: acks, replication, idempotence, retries, transactions, the outbox, testing and monitoring.

A complete guide to Playwright for Java: locators, auto waiting, JUnit fixtures, Spring Boot setup, page objects, auth, tracing, CI and flakiness.

A complete guide to custom queries in Spring Data JPA: derived queries, JPQL and native SQL, paging, Specifications, fragments, streaming and tests.

Debug a production Java problem without a debugger: build a timeline from logs, follow one request with a correlation id and raise log levels safely.

Write a Dockerfile for a Java service with a multi-stage build, dependency caching, a non-root user, container-aware memory settings and a health check.

Design stable REST URLs: plural nouns, shallow nesting, query strings for filters, identifiers that never change and a plan for the day a name must change.

Implement cursor (keyset) pagination in a Spring Boot API with an opaque cursor, a stable sort and a limit plus one query, using JdbcClient or Spring Data.

Add ETags to a Spring REST API: ShallowEtagHeaderFilter, strong ETags from a version, If-None-Match for 304 responses and If-Match for lost update protection.

Implement an Idempotency-Key header in Spring Boot so a retried POST returns the first result: key storage, request hashing, concurrency and expiry.

Document a Java REST API with OpenAPI 3: springdoc-openapi in Spring Boot, annotations for summaries and responses, security schemes and exporting the spec.