I've just added an <alias> tag for XML bean definitions. For example:
<alias name="myBean" alias="myAlias"/>
This allows to define aliases separate from the original bean definition,
for example to link in a bean from some other file under a different name.
See http://opensource.atlassian.com/projects/spring/browse/SPR-554.
We've already had a BeanReferenceFactoryBean that could achieve this, but
the <alias> tag is a much nicer syntax.
One use case where this can be used within the framework is the
SingletonBeanFactoryLocator: Instead of defining an alias for another
factory through a "java.lang.String" definition there, you can simply define
an <alias> tag now.
BTW, to remove a circular root package dependency between "beans" and
"jndi", I've recently removed JndiBeanFactoryLocator without replacement.
ContextJndiBeanFactoryLocator in the "context" package still exists and is
the only one that's actually used anyway. The "context" package is allowed
to depend on "jndi", but the "beans" package isn't.
Effectively, the BeanFactoryLocator mechanism will usually only be used for
ApplicationContexts anyway, in particular since we default to full contexts
for our EJB support classes. Hence, the relevant implementations are the
ones in the "context.access" package, even if the interfaces and some base
implementations reside in "beans.factory.access".
Juergen
|