You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by wo...@apache.org on 2008/10/29 10:22:47 UTC
svn commit: r708842 -
/portals/jetspeed-2/portal/trunk/xdocs/spring-config.xml
Author: woonsan
Date: Wed Oct 29 02:22:47 2008
New Revision: 708842
URL: http://svn.apache.org/viewvc?rev=708842&view=rev
Log:
Adds info about dynamic bean aliasing
Modified:
portals/jetspeed-2/portal/trunk/xdocs/spring-config.xml
Modified: portals/jetspeed-2/portal/trunk/xdocs/spring-config.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/xdocs/spring-config.xml?rev=708842&r1=708841&r2=708842&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/xdocs/spring-config.xml (original)
+++ portals/jetspeed-2/portal/trunk/xdocs/spring-config.xml Wed Oct 29 02:22:47 2008
@@ -141,6 +141,37 @@
<div class="source"><pre>spring.filter.key = portal.ldap</pre></div>
</p>
</subsection>
+ <subsection name="Spring Filter Keys and Dynamic Bean Aliasing">
+ <p>Because the ids of every beans must be unique within the BeanFactory or ApplicationContext the bean is hosted in, we cannot use same bean id for several different beans.</p>
+ <p>For example, there could be two options to choose page manager bean component: xml-based page manager or database-based page manager. If some other beans should refer the filtered page manager, they should be grouped in a same category as the filtered page manager. So, there should be many redundant bean definitions which make the maintenance very difficult.</p>
+ <p>Therefore, Jetspeed provides a way to alias beans dynamically with spring bean filtering solution.
+ In the following example, the first two bean definitions do not have id, but they have the same <strong><code>j2:alias</code></strong> meta data value. Jetspeed custom BeanFactory register the alias(es) dynamically according to this meta data.
+ Finally, the last bean definition can refer the selected bean by using the alias, <strong><code>org.apache.jetspeed.page.PageManager</code></strong>.
+ <div class="source"><pre><bean class="org.springframework.beans.factory.config.BeanReferenceFactoryBean">
+ <meta key="j2:cat" value="xmlPageManager" />
+ <meta key="j2:alias" value="org.apache.jetspeed.page.PageManager" />
+ <property name="targetBeanName" value="xmlPageManager" />
+</bean>
+
+<bean class="org.springframework.beans.factory.config.BeanReferenceFactoryBean">
+ <meta key="j2:cat" value="dbPageManager" />
+ <meta key="j2:alias" value="org.apache.jetspeed.page.PageManager" />
+ <property name="targetBeanName" value="dbPageManager" />
+</bean>
+
+<bean id="org.apache.jetspeed.portalsite.PortalSite" name="portalSite"
+ class="org.apache.jetspeed.portalsite.impl.PortalSiteImpl">
+ <meta key="j2:cat" value="default" />
+ <constructor-arg index="0">
+ <ref bean="org.apache.jetspeed.page.PageManager" />
+ </constructor-arg>
+</bean></pre>
+ </div>
+ </p>
+ <p>
+ <em>Note: multiple alias names can set to j2:alias meta data value by a string separated by comma or space.</em>
+ </p>
+ </subsection>
</section>
</body>
</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org