public interface SmartInitializingSingleton
BeanFactorybootstrap. This interface can be implemented by singleton beans in order to perform some initialization after the regular singleton instantiation algorithm, avoiding side effects with accidental early initialization (e.g. from
ListableBeanFactory.getBeansOfType(java.lang.Class<T>)calls). In that sense, it is an alternative to
InitializingBeanwhich gets triggered right at the end of a bean's local construction phase.
This callback variant is somewhat similar to
ContextRefreshedEvent but doesn't
require an implementation of
with no need to filter context references across a context hierarchy etc.
It also implies a more minimal dependency on just the
and is being honored by standalone
not just in an
NOTE: If you intend to start/manage asynchronous tasks, preferably
Lifecycle instead which offers
a richer model for runtime management and allows for phased startup/shutdown.
ListableBeanFactory.getBeansOfType(java.lang.Class<T>)calls within this method won't trigger accidental side effects during bootstrap.
NOTE: This callback won't be triggered for singleton beans
lazily initialized on demand after
and not for any other bean scope either. Carefully use it for beans
with the intended bootstrap semantics only.