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 CRUD REST API with Spring Boot - Basic Structure of Controller, Service, and Repository
A step-by-step guide to implementing CRUD (Create, Read, Update, Delete) REST API with Spring Boot. Build the three-layer architecture of Controller, Service, and Repository from scratch, and walk through setting up all four endpoints: GET, POST, PUT, and DELETE.