Spring Boot Interview Question

What are the most common Spring Boot annotations?

Updated 2026-08-16 · 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.

Key takeaways
  • SpringBootApplication combines configuration, auto configuration, and component scanning.
  • RestController and RequestMapping define web endpoints.
  • Autowired injects dependencies, and stereotypes like Service register beans.

The ones you will use most

@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.

Frequently asked questions

What does SpringBootApplication combine?

It bundles Configuration, EnableAutoConfiguration, and ComponentScan into one convenient annotation placed on the main class.

What is the difference between RequestMapping and GetMapping?

RequestMapping can map any HTTP method, while GetMapping is a shortcut specifically for GET requests. Similar shortcuts exist for POST, PUT, and DELETE.

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