Skip to Content
0
Former Member
Apr 30, 2018 at 11:29 PM

How to correctly merge maps in spring context using hybris mapMergeDirective

1599 Views

Hi to all, please suggest what I do wrong. In root spring context I have the next declarations

 <util:map id="prefixPriorities" key-type="java.lang.String" value-type="java.lang.Integer">
     <entry key="address_customer" value="101" />
     <entry key="colorenum" value="100" />
 </util:map>

 <bean id="fileOrderComparator" class="de.hybris.platform.acceleratorservices.dataimport.batch.FileOrderComparator">
     <property name="prefixPriority" ref="prefixPriorities"/>
 </bean>

And child spring context is:

 <bean id="capacityEnumMapping" depends-on="prefixPriorities" parent="mapMergeDirective">
     <property name="key" value="capacityenum" />
     <property name="value">
         <value type="java.lang.Integer">
             100
         </value>
     </property>
 </bean>

During starting the server I'm facing the next error

 Cannot convert value of type 'org.springframework.beans.factory.config.TypedStringValue' to required type 'java.lang.Integer' for property 'prefixPriority[capacityenum]': PropertyEditor [org.springframework.beans.propertyeditors.CustomNumberEditor] returned inappropriate value of type 'org.springframework.beans.factory.config.TypedStringValue'

Thanks