What are the most common Spring Boot annotations?
Updated 2026-07-10 · Beginner friendly
Quick answer
The most common annotations are SpringBootApplication to start the app, RestController and RequestMapping to build web endpoints, Autowired for dependency injection, and the stereotype annotations Component, Service, and Repository to define beans. Knowing what each does and roughly when to use it covers most day to day Spring Boot code.
The ones you will use most
- SpringBootApplication: marks the main class and enables auto configuration.
- RestController: marks a class that handles web requests and returns data.
- RequestMapping, GetMapping, PostMapping: map URLs to methods.
- Autowired: injects a dependency.
- Component, Service, Repository: define beans by layer.
@RestController
class HelloController {
@GetMapping("/hello")
String hello() { return "hi"; }
}
In the interview
Do not just list annotations, group them by purpose: startup, web, injection, and beans. Organising your answer this way makes it clear you understand the roles rather than memorising a list.
Common follow up questions
Related interview questions
Want the full Spring Boot guide?
Read every Spring Boot concept with notes, diagrams, and code in one place. Track your progress as you go.
Open the Spring Boot guide All Spring Boot questions