Method Detail

registerSingleton

Register the given existing object as singleton in the bean registry,
under the given bean name.

The given instance is supposed to be fully initialized; the registry
will not perform any initialization callbacks (in particular, it won't
call InitializingBean's afterPropertiesSet method).
The given instance will not receive any destruction callbacks
(like DisposableBean's destroy method) either.

When running within a full BeanFactory: Register a bean definition
instead of an existing instance if your bean is supposed to receive
initialization and/or destruction callbacks.

Typically invoked during registry configuration, but can also be used
for runtime registration of singletons. As a consequence, a registry
implementation should synchronize singleton access; it will have to do
this anyway if it supports a BeanFactory's lazy initialization of singletons.

To check whether a bean factory contains a bean definition with a given name,
use ListableBeanFactory's containsBeanDefinition. Calling both
containsBeanDefinition and containsSingleton answers
whether a specific bean factory contains a local bean instance with the given name.

Use BeanFactory's containsBean for general checks whether the
factory knows about a bean with a given name (whether manually registered singleton
instance or created by bean definition), also checking ancestor factories.

NOTE: This lookup method is not aware of FactoryBean prefixes or aliases.
You need to resolve the canonical bean name first before checking the singleton status.

Parameters:

beanName - the name of the bean to look for

Returns:

if this bean factory contains a singleton instance with the given name