Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
Spring Boot 10 questions

Caching, Async & Scheduling

Learn caching strategies using Redis, asynchronous execution with @Async, and cron scheduling using Spring's @Scheduled.

More Spring Boot
Interview questions 1–10 of 10
1

How does caching work in Spring Boot with @EnableCaching and @Cacheable?

Spring's caching abstraction lets you cache the result of an expensive method call transparently, without chan...

Read answer →
2

What is the difference between @Cacheable, @CachePut, and @CacheEvict?

@Cacheable checks the cache before running the method and skips execution entirely on a cache hit. @CachePut a...

Read answer →
3

How do you integrate Redis as a distributed cache in Spring Boot?

Spring Boot's default cache manager (ConcurrentMapCacheManager) stores cached data in local JVM memory, which...

Read answer →
4

How does @Async work in Spring Boot and what are its limitations?

@Async, enabled with @EnableAsync, runs an annotated method on a separate thread from a configured thread pool...

Read answer →
5

How do you configure a custom thread pool for @Async tasks?

Without a custom configuration, Spring's default async executor is SimpleAsyncTaskExecutor, which creates a br...

Read answer →
6

How does @Scheduled work in Spring Boot, and what is the difference between fixedRate, fixedDelay, and cron?

@Scheduled, enabled with @EnableScheduling, runs a void, no-argument method automatically on a recurring basis...

Read answer →
7

How do you prevent scheduled tasks from running on multiple instances (Distributed Locking)?

@Scheduled runs independently on every JVM instance of an application, so a horizontally scaled service with 3...

Read answer →
8

What is the difference between CompletableFuture and @Async, and how are they used together?

CompletableFuture is a general-purpose Java class (not Spring-specific) representing a value that will be avai...

Read answer →
9

What are the common cache eviction policies (LRU, LFU, TTL) and how do you configure them in Spring Boot (Caffeine)?

An unbounded cache eventually exhausts memory, so eviction policies decide which entries to remove once a size...

Read answer →
10

How do you handle exceptions in @Async methods, and why doesn't try-catch in the caller work?

Because an @Async method runs on a completely different thread, an exception thrown inside it cannot propagate...

Read answer →