java - Spring declaration for interfaces with the same implementation -


i have problem spring.

i have 2 separate interfaces, findunconditionaldiscountvaluesstrategy , findconditionaldiscountvaluesstrategy. these interfaces implemented in same class mmfgfindpricingwithcurrentpricefactorystrategy.

this declared in spring configuration file 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, use 2 interfaces in class

private findunconditionaldiscountvaluesstrategy findunconditionaldiscountvaluesstrategy; private findconditionaldiscountvaluesstrategy findconditionaldiscountvaluestrategy; 

with getter , setter (getter protected , setter @required).

now have declared class in way in 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 same 2 interfaces, because implementation class same.

but @ runtime obtain error:

org.springframework.beans.factory.beaninitializationexception: property 'findconditionaldiscountvaluestrategy' required bean 'mmfgordercalculationstrategy'

how have declare ref in 2 properties?

there typo error. property called findconditionaldiscountvaluestrategy. in class name findconditionaldiscountvaluesstrategy.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -