Controller Articles
2 articles about Controller. Explore Spring Boot implementation, design, and operations across related topics.
-
How to Write Unit Tests for Controllers Using MockMvc in Spring Boot
A guide to writing Controller-specific tests that start the Spring context minimally with @WebMvcTest and verify HTTP requests and responses with MockMvc. Covers combining @MockBean with Mockito, JSON verification with jsonPath, and testing validation errors, with implementation 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.