Controller Articles
2 articles about Controller. Explore Spring Boot implementation, design, and operations across related topics.
-
How to Write Controller Unit Tests with MockMvc in Spring Boot - Introduction to @WebMvcTest
Achieve fast, DB-free, copy-paste-ready Controller unit tests with @WebMvcTest and MockMvc. Explains how to mock Services with @MockBean, validate JSON with jsonPath, handle validation errors (400), and integrate Security (@WithMockUser) with practical examples.
-
Implementing REST API CRUD in Spring Boot - The Basic Controller, Service, and Repository Structure
A step-by-step guide to implementing REST API CRUD (Create, Read, Update, Delete) in Spring Boot using the three-layer Controller, Service, and Repository architecture. Get the four GET/POST/PUT/DELETE endpoints running with copy-paste code, and verify them end-to-end with curl.