我有一堆规则要注入一组类,如下所示:
<bean id="rule1" class="com.vikdor.rules.Rule1" />
<bean id="rule2" class="com.vikdor.rules.Rule2" />
<bean id="rule3" class="com.vikdor.rules.Rule3" />
<bean id="rule4" class="com.vikdor.rules.Rule4" />
<bean id="rule5" class="com.vikdor.rules.Rule5" />
<util:list id="commonRules">
<ref bean="rule1" />
<ref bean="rule3" />
<ref bean="rule5" />
</util:list>
<util:list id="normalInvRules">
<!-- Include common rules -->
<ref bean="rule4" />
</util:list>
<util:list id="prepaidInvRules">
<!-- Include common rules -->
<ref bean="rule2" />
</util:list>
如何在与normalInvRules
和对应的列表中包含通用规则列表prepaidInvRules
?
规则的数量(例如 rule1、rule2 等)更多,数量组(normalInvRules、prepaidInvRules 等)也更多。所以,我想知道是否有办法避免重复通用规则,只列出特定规则并包含对通用列表的引用。