Bird
0
0

What will happen if @EnableCaching is missing but @Cacheable is used on a method?

medium📝 component behavior Q5 of 15
Spring Boot - Caching
What will happen if @EnableCaching is missing but @Cacheable is used on a method?
ACaching will not work; method executes every time
BCaching works normally without @EnableCaching
CApplication fails to start with error
DCache is enabled only for that method
Step-by-Step Solution
Solution:
  1. Step 1: Role of @EnableCaching

    @EnableCaching activates Spring's caching support globally.
  2. Step 2: Effect of missing @EnableCaching

    Without it, @Cacheable annotations are ignored; methods run every time.
  3. Final Answer:

    Caching will not work; method executes every time -> Option A
  4. Quick Check:

    No @EnableCaching means no caching [OK]
Quick Trick: Always add @EnableCaching to activate caching [OK]
Common Mistakes:
  • Thinking @Cacheable alone enables caching
  • Expecting errors without @EnableCaching
  • Assuming partial caching works

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes