
How to Write a REST Controller in Spring MVC Step by Step
Write a REST controller in Spring MVC with request mappings, status codes, validation and a test, using a small orders resource as the example.
Everything you need to level up your coding skills.

Write a REST controller in Spring MVC with request mappings, status codes, validation and a test, using a small orders resource as the example.

Configure Spring Boot logging: set levels per package, write rotating files, use profiles, change levels at runtime and add MDC fields.

Write a timing aspect for Spring that flags slow methods: a custom annotation, threshold logging, Micrometer timers and the limits of proxy timing.

Choose between Lombok, records and hand written classes by looking at the type: value objects, JPA entities, builders and mutable beans each have a best fit.

The OWASP Top Ten web risks mapped to Java and Spring: what each one looks like in code, a fix for each and where to read the full guidance.

Use ExecutorService correctly: choose a pool type, submit Runnable and Callable, handle Future results and exceptions, bound the queue and shut down cleanly.

Learn Jakarta Bean Validation: built in constraints, validating objects and methods, groups, cascading, custom constraints and messages.

Test async code and schedulers in Java reliably: Awaitility instead of sleep, injectable executors, fake clocks and Spring Async and Scheduled.

Turn on unified GC logging, read a G1 log line field by field and recognize the patterns for leaks, undersized heaps, long pauses and allocation spikes.

Implement event sourcing and CQRS in Java: an event store, aggregates rebuilt from events, projections for reads, snapshots and when the cost is justified.

Build a REST API in Quarkus with the quarkus-rest and quarkus-rest-jackson extensions: resources, DTO records, status codes, exception mappers and a test.

Use JSF AJAX with f:ajax: the execute and render attributes, event triggers, listeners, ids inside naming containers and common reasons nothing updates.
We send one email when a new post is published. No spam.