← All writing

Spring

Top 10 Spring Boot Annotations

A reference to Spring Boot annotations for application setup, dependency injection, and web endpoints.

1 view Copy this article’s link to your clipboard.
  1. @SpringBootApplication: Marks the main class of a Spring Boot application, enabling auto-configuration, component scanning, and configuration.
  2. @RestController: Indicates a controller class that handles HTTP requests and returns data directly as JSON or XML.
  3. @Autowired: Automatically injects dependencies into a bean, simplifying dependency management.
  4. @RequestMapping: Maps HTTP requests to specific handler methods or classes in a controller.
  5. @GetMapping: Maps HTTP GET requests to a specific method in a controller.
  6. @PostMapping: Maps HTTP POST requests to a specific method for creating resources.
  7. @Service: Marks a class as a service component, typically containing business logic.
  8. @Repository: Indicates a class as a Data Access Object (DAO) for database operations, enabling exception translation.
  9. @Configuration: Defines a class that provides bean definitions and configuration for the Spring application context.
  10. @Bean: Declares a method that produces a bean to be managed by the Spring container.
More articles →