I have a problem with Spring.
I have two separate interfaces, findUnconditionalDiscountValuesStrategy and findConditionalDiscountValuesStrategy. These interfaces are implemented in the same class MmfgFindPricingWithCurrentPriceFactoryStrategy.
This is declared in the spring configuration file like this:
<alias name="mmfgFindPricingWithCurrentPriceFactoryStrategy" alias="currentFactoryFindPricingStrategy"/>
<bean id="mmfgFindPricingWithCurrentPriceFactoryStrategy" class="com.mmfg.mmfgacceleratorcore.order.strategies.calculation.impl.MmfgFindPricingWithCurrentPriceFactoryStrategy" parent="abstractBusinessService">
<property name="findPricingWithCurrentPriceFactoryStrategy" ref="original-currentFactoryFindPricingStrategy"/>
<property name="configurationService" ref="configurationService"/>
<property name="mmfgSessionService" ref="mmfgSessionService"/>
<property name="mmfgUtilsDao" ref="mmfgUtilsDao" />
</bean>
Now, I use the two interfaces in a class
private FindUnconditionalDiscountValuesStrategy findUnconditionalDiscountValuesStrategy;
private FindConditionalDiscountValuesStrategy findConditionalDiscountValueStrategy;
with getter and setter (getter protected and setter @Required).
Now I have declared this class in this way in the spring configuration file:
<bean id="mmfgOrderCalculationStrategy" class="com.mmfg.mmfgacceleratorcore.order.strategies.calculation.impl.DefaultMmfgOrderCalculationStrategy">
<property name="findUnconditionalDiscountValuesStrategy" ref="currentFactoryFindPricingStrategy"/>
<property name="findConditionalDiscountValuesStrategy" ref="currentFactoryFindPricingStrategy"/>
<property name="modelService" ref="modelService" />
<property name="commonI18NService" ref="commonI18NService" />
<property name="calculationService" ref="calculationService"/>
</bean>
the ref is the same for the two interfaces, because the implementation class is the same.
But at runtime I obtain this error:
org.springframework.beans.factory.BeanInitializationException: Property 'findConditionalDiscountValueStrategy' is required for bean 'mmfgOrderCalculationStrategy'
How I have to declare the ref in the two properties?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire