Skip to main content

Module 17: Complete Reference of Spring Boot Annotations

Module Objectives​

This module is a comprehensive reference of all the Spring Boot annotations you will encounter in development. It covers:

  • Core Spring annotations (IoC, DI, configuration)
  • Web and REST annotations
  • Persistence annotations (JPA/Hibernate)
  • Security, testing, and advanced annotations

Module Outline​

#ChapterContent
1Core Spring Annotations@Component, @Service, @Repository, @Configuration, @Bean, @Autowired, @Value, @Profile, @Scope, @Conditional...
2Web and REST Annotations@RestController, @RequestMapping, @GetMapping, @PostMapping, @RequestBody, @PathVariable, @ResponseStatus, @CrossOrigin...
3Data and JPA Annotations@Entity, @Table, @Id, @GeneratedValue, @Column, @OneToMany, @ManyToOne, @Query, @Transactional, @Modifying...
4Security, Test, and Advanced Annotations@EnableWebSecurity, @PreAuthorize, @SpringBootTest, @MockBean, @Scheduled, @Async, @EnableCaching, @Validated...
5Complete A-Z Dictionary120+ annotations sorted alphabetically with short descriptions — quick reference

How to Use This Module​

Reference Guide

This module is designed as an annotations dictionary. You don't need to read it from start to finish. Use it as a reference when you encounter an unknown annotation or when you're looking for the right annotation for your need.


Journey of an HTTP Request in Spring Boot​

Overview: from Client to Database​


Detailed Flow with Annotations​


Layered Architecture and Their Annotations​


Concrete Example: GET /api/users/1​


Concrete Example: POST /api/products (creation)​


Color Legend​

ColorLayerMain Annotations
🔵 BlueClientHTTP Request / JSON Response
🔴 RedSecurity@EnableWebSecurity, JwtFilter, @PreAuthorize
🟢 GreenController@RestController, @GetMapping, @PostMapping
🟡 YellowService@Service, @Transactional, business logic
🟠 OrangeRepository@Repository, JpaRepository, @Query
🟣 PurpleDatabase@Entity, @Table, @Id, @Column

Annotations by Category​

Spring Boot Annotations
├── Core Spring
│ ├── Stereotypes: @Component, @Service, @Repository, @Controller
│ ├── Configuration: @Configuration, @Bean, @PropertySource
│ ├── Injection: @Autowired, @Qualifier, @Value, @Inject
│ └── Lifecycle: @PostConstruct, @PreDestroy, @Scope
│
├── Web / REST
│ ├── Controllers: @RestController, @Controller
│ ├── Mapping: @GetMapping, @PostMapping, @PutMapping, @DeleteMapping, @PatchMapping
│ ├── Parameters: @RequestParam, @PathVariable, @RequestBody, @RequestHeader
│ └── Responses: @ResponseBody, @ResponseStatus, @ExceptionHandler
│
├── Data / JPA
│ ├── Entities: @Entity, @Table, @Id, @GeneratedValue, @Column
│ ├── Relationships: @OneToOne, @OneToMany, @ManyToOne, @ManyToMany
│ ├── Queries: @Query, @NamedQuery, @Modifying
│ └── Transactions: @Transactional, @EnableJpaRepositories
│
├── Security
│ ├── Config: @EnableWebSecurity, @EnableMethodSecurity
│ └── Authorization: @PreAuthorize, @PostAuthorize, @Secured
│
├── Test
│ ├── Boot: @SpringBootTest, @WebMvcTest, @DataJpaTest
│ ├── Mock: @MockBean, @SpyBean
│ └── Config: @TestConfiguration, @ActiveProfiles
│
└── Advanced
├── Async: @Async, @Scheduled, @EnableScheduling
├── Cache: @Cacheable, @CacheEvict, @EnableCaching
├── Validation: @Valid, @NotNull, @Size, @Email
└── Boot: @SpringBootApplication, @ConditionalOnProperty

Next Step​

➡️ Chapter 1: Core Spring Annotations


⬅️ Back to Home