Complete the code to enable asynchronous execution of the method.
@[1]
public void sendEmail() {
// email sending logic
}Complete the code to enable async support in the Spring Boot application.
@Configuration @Enable[1] public class AsyncConfig { }
Fix the error in the async method declaration to return a Future result.
@Async public [1]<String> processData() { // processing logic return new AsyncResult<>("done"); }
Fill both blanks to correctly configure a custom executor for async methods.
@Bean public Executor [1]() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(5); executor.setMaxPoolSize(10); executor.setQueueCapacity(25); executor.initialize(); return [2]; }
Fill all three blanks to correctly annotate and configure async method with custom executor.
@Async([1]) public void runTask() { // task logic } @Bean public Executor [2]() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(3); executor.setMaxPoolSize(6); executor.setQueueCapacity(10); executor.initialize(); return [3]; }
