Performance: @EnableAsync annotation
MEDIUM IMPACT
This annotation affects how tasks run asynchronously, improving responsiveness by offloading work from the main thread.
@Service public class MyService { @Async public void longTask() { // long running code } } // @EnableAsync must be added to a @Configuration class (e.g., your @SpringBootApplication main class)
@Service
public class MyService {
public void longTask() {
// long running code
}
}| Pattern | Thread Usage | Main Thread Blocking | Responsiveness Impact | Verdict |
|---|---|---|---|---|
| Synchronous method | Single main thread | Blocks main thread | High input delay | [X] Bad |
| @Async method with @EnableAsync | Separate worker thread | No main thread block | Improved input responsiveness | [OK] Good |