What are Microservices? — Spring Technical Interview Questions & Answers
Small, independently deployable services.
What are Microservices?
- Microservices split a big system into small services that deploy independently.
- Each service focuses on one business capability.
- They communicate over the network (REST/messaging).
- Benefit: scale and deploy pieces separately; cost: more ops complexity.
- Independence + network communication + trade-offs.
Technical Interview Tip: Define microservice and one trade-off.
Code Examples for What are Microservices?
What are Microservices? — working example
// Topic: What are Microservices?
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
class TopicController {
@GetMapping("/api/topic")
String topic() {
return "Spring Boot: What are Microservices?";
}
}What are Microservices?: GET /api/topic returns this title string.
How to Explain What are Microservices? to an Interviewer
What is What are Microservices (intro)?
Used for a tiny REST app localhost:8080 Not just the heading
Give one small example of What are Microservices (intro).
@SpringBootApplication + one controller Small, independently deployable services
What mistake do beginners make with What are Microservices (intro)?
calling Boot ‘just Spring XML’ Show the fix
Where do you use What are Microservices (intro)?
localhost:8080 a tiny REST app