Backend Development
Spring Boot
Subjective
Oct 03, 2025
Explain Spring Boot Virtual Threads support (Project Loom).
Detailed Explanation
Virtual threads provide lightweight concurrency:\n\n@Configuration\n@EnableAsync\npublic class VirtualThreadConfig {\n @Bean\n public Executor taskExecutor() {\n return Executors.newVirtualThreadPerTaskExecutor();\n }\n}\n\n@Service\npublic class VirtualThreadService {\n @Async\n public CompletableFuture processAsync() {\n // This runs on virtual thread\n Thread.sleep(1000); // Won't block OS thread\n return CompletableFuture.completedFuture("Processed");\n }\n}
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts