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 with Spring Boot - Basic Structure of Controller, Service, and Repository
A step-by-step guide to implementing REST API CRUD (Create, Read, Update, Delete) with Spring Boot using a three-layer structure of Controller, Service, and Repository. Get the four GET/POST/PUT/DELETE endpoints running via copy-paste, with end-to-end coverage including verification using curl.