I have two beans indCartStrategy
and usCartStrategy
, with different id but the same class and different parameter values. I am aliasing both of them to the same alias. Instead of calling my later alias id it is still calling the former bean, not the one that I have declared.
<alias name="indCartStrategy" alias="cartStrategy"/>
<bean id="indCartStrategy" parent="defaultCartStrategy" class="com.strategy.impl.USCartStrategyImpl">
<property name="cartValidators">
<map key-type="com.validation.USCartValidationType">
<entry key="CART_PAGE">
<list value-type="com.validation.USCartValidator">
<bean class="com.validation.impl.USValidator2"/>
</list>
</entry>
</map>
</property>
</bean>
<alias name="usCartStrategy" alias="cartStrategy"/>
<bean id="usCartStrategy" parent="defaultCartStrategy" class="com.strategy.impl.USCartStrategyImpl">
<property name="cartValidators">
<map key-type="com.validation.USCartValidationType">
<entry key="CART_PAGE">
<list value-type="com.validation.USCartValidator">
<bean class="com.validation.impl.USValidator1"/>
<bean class="com.validation.impl.USValidator2"/>
</list>
</entry>
</map>
</property>
</bean>
In my bean i.e. indCartStrategy
USValidator1
is not getting called still when I am calling cartStrategy both the validators i.e. USValidator1
and USValidator2
are getting called.