How to use the Spring Boot Annotations Cheat Sheet
- 1. Search or browseType a word like the function or task you need, or pick a section.
- 2. CopyEach snippet has its own Copy button, so you can paste it straight into your editor.
- 3. DownloadSave the whole Spring Boot Annotations cheat sheet as plain text or Markdown for offline revision.
What's in it
It's written for Spring Boot 3, with notes where annotations changed in recent versions. The 36 snippets are organised into 9 sections: Core, Config, Web, Validation, JPA, Scheduling & async, Caching, Testing, Lombok.
Example
Search "rest" to see that @RestController is simply @Controller plus @ResponseBody, so methods return JSON instead of view names. Search "mock" to find @MockitoBean, which replaced @MockBean in Spring Boot 3.4; older projects still use @MockBean.
Tips for using it
- Group annotations by layer when revising: web, service, data, configuration.
- Lombok annotations come from a separate library; don't confuse them with Spring's.
A quick look, one snippet per section
- Core:
@SpringBootApplication(@Configuration + @EnableAutoConfiguration + @ComponentScan) - Config:
@Value("${app.name}")(inject a property) - Web:
@RestController(@Controller + @ResponseBody (returns JSON)) - Validation:
@NotNull · @NotBlank · @Size(min = 2) · @Email · @Min(18) · @Pattern(regexp = "…")(bean Validation constraints) - JPA:
@Entity · @Table(name = "users")(map a class to a table) - Scheduling & async:
@EnableScheduling + @Scheduled(cron = "0 0 9 * * *")(run a job at 9:00 every day) - Caching:
@EnableCaching + @Cacheable("users") · @CacheEvict(cache method results) - Testing:
@SpringBootTest(full application context) - Lombok:
@Data · @Getter · @Setter · @Builder · @RequiredArgsConstructor · @Slf4j(common Lombok annotations (a separate library))
Search the box above for the rest of the Spring Boot Annotations snippets, or download the full sheet.
Frequently asked questions
Which Spring Boot version?
Spring Boot 3.x; version changes are noted.
Are Spring Security annotations included?
Not in this sheet; it covers the most common general annotations.
Is the Spring Boot Annotations cheat sheet free?
Yes. You can search, read and copy every snippet in the Spring Boot Annotations cheat sheet without signing up. The first time you download it, we ask once for your name and WhatsApp number; after that downloads and every other Uncodemy tool open straight away.