Comment From: jhoeller
Have you seen a concrete effect within a virtual thread here? As long as the target supplier does not do any I/O or other blocking operations, this should not make a difference. That said, SingletonSupplier
comes as a reusable component, so I can see why it should be able to deal with blocking scenarios as well.
Comment From: quaff
It's very common that target supplier invoke I/O, for example querying data from database. This is inspired by This Tomcat mailing list discussion from https://github.com/spring-projects/spring-framework/issues/31212.
Comment From: jhoeller
Internally we only use SingletonSupplier
for lazy data structures and lazy bean references. So one-time late initialization only, quite different from per-operation synchronization in a database driver. Nevertheless, this looks easy enough to revise, even if just as a defensive measure.