Service Discovery — Spring Technical Interview Questions & Answers
How services find each other at runtime.
Service Discovery
- Service Discovery (micro) is a Spring topic. In plain words you use it for a short Service Discovery micro example in a small REST app. Don’t start with a slogan — start with that picture.
- Smallest example: the smallest Service Discovery micro example you can type. Type it, run it, and say what you see. If you can do that from memory, you know Service Discovery (micro).
- From the example next to this theory: How services find each other at runtime.
- Trap: only saying “Service Discovery micro” with no example. Fix that before you talk about advanced Spring.
- Viva: what is Service Discovery (micro)? Then show the smallest Service Discovery micro example you can type. Then name the trap.
Technical Interview Tip: What is Service Discovery (micro)? Show this: the smallest Service Discovery micro example you can type. Trap: only saying “Service Discovery micro” with no example.
Code Examples for Service Discovery
Service Discovery — working example
// Topic: Service Discovery
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: Service Discovery";
}
}Service Discovery: GET /api/topic returns this title string.
How to Explain Service Discovery to an Interviewer
What is Service Discovery (micro)?
Used for a short Service Discovery micro example a small REST app Not just the heading
Give one small example of Service Discovery (micro).
the smallest Service Discovery micro example you can type How services find each other at runtime
What mistake do beginners make with Service Discovery (micro)?
only saying “Service Discovery micro” with no example Show the fix
Where do you use Service Discovery (micro)?
a small REST app a short Service Discovery micro example