Bird
0
0

Which annotation is used in Spring Boot to mark a method for caching?

easy📝 Syntax Q3 of 15
Spring Boot - Caching
Which annotation is used in Spring Boot to mark a method for caching?
A@Service
B@Autowired
C@RequestMapping
D@Cacheable
Step-by-Step Solution
Solution:
  1. Step 1: Recall caching annotations in Spring Boot

    The @Cacheable annotation marks methods whose results should be cached.
  2. Step 2: Differentiate from other annotations

    @Autowired injects dependencies, @RequestMapping maps URLs, @Service marks service classes.
  3. Final Answer:

    @Cacheable -> Option D
  4. Quick Check:

    Caching annotation = @Cacheable [OK]
Quick Trick: Use @Cacheable to enable caching on methods [OK]
Common Mistakes:
  • Confusing @Cacheable with @Autowired
  • Using @RequestMapping for caching
  • Mistaking @Service for caching annotation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes