We sometimes need to get access to the virtual thread executor. The API is only available on Java 21 so we can't compile against it (without multi-release JARs), but it's possible to get it via reflection. This should be encapsulated in a separate class.

Besides that, sometimes it's nice to have a bean which is only there when virtual threads are enabled, because then you can use an ObjectProvider and write ifs, which is sometimes easier than rearranging the auto-configuration bean methods.

Comment From: mhalbritter

Closed by eeb1e1fc35267f5a200284a8390dccc10fc8b355

Comment From: mhalbritter

We decided to revert that. With #36624 implemented, we can get away without the VirtualThreads bean. If an executor is needed, Spring Framework provides a VirtualThreadTaskExecutor.