-3

I am new to Spring framework and I have following concern, please help.

How to inject List in Map using Spring 2.5?

I refered following link for help, but it didnt help

How to inject a Map<String, List> in java springs?

Error in console: Caused by: org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 30; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'util:list'.

Community
  • 1
  • 1

1 Answers1

-1

Injecting/Passing collection data types

class Test{
      private List Fruits;
      private Set athletes; 
      private Map Country_capital;
      ...
}

spring.xml

<beans>
  <bean id="t" class="Test">
    <property name="Fruits">
      <list>
        <value>Apple</value>
        <value>Mango</value>
      </list>
    </property>
    <property name="athletes">
      <set>
        <value>Haile Gebressesa</value>
        <value>Bolt</value>
      </set>
    </property>
    <property name="Country-capital">
      <map>
        <Entry key="USA" value="Washington DC"/> 
        <Entry key="UK" value="London"/>
      </map>
    </property>
  </bean>
</beans>
Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
Abereham
  • 141
  • 3
  • 9