on 05-01-2018 12:29 AM
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
Used the next approach and all works fine. Very strange issue
<bean depends-on="prefixPriorities" parent="mapMergeDirective">
<property name="sourceMap">
<map>
<entry key="capacityenum" value="100"/>
</map>
</property>
</bean>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you already tried the following? Not sure this will fix your issue, but the additional type declaration on your value in the child context shouldn't be necessary.
As you've already defined the value type in map prefixPriorities
, try simply assigning the value in your child spring context without redeclaring the type of java.lang.Integer
:
<bean id="capacityEnumMapping" depends-on="prefixPriorities" parent="mapMergeDirective">
<property name="key" value="capacityenum" />
<property name="value" value="100" />
</bean>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.