When the
scope is defined to
singleton,
there is only one instance for the definition. In other words, there
is only one instance for each element id. The singleton instance is
cached in ElementFactory. On the sequence invocation of
getElement(String
id), the cached instance will be returned instead of creating
a new instance.
The following diagram shows how the singleton scope
works:
Following
is a sample definition for singleton scope:
<mypackage.SimpleElement id="aSimpleElement" Scope="singleton"/>