I have got a simple project using spring.
In the spring config, I have a map defined as:
<util:map id="myMap">
<entry key="1" value="a"/>
<entry key="2" value="b/>
<entry key="3" value="c"/>
<entry key="4" value="d"/>
<entry key="5" value="e"/>
</util:map>
In my application code, I want to get this map out of spring using ClassPathXmlApplicationContext. But It seems like I cannot use getBean function as (Scala):
val cx = new ClassPathXmlApplicationContext("myservice.xml")
val map: java.util.Map[String, String] = cx.getBean("myMap").asInstanceOf[java.util.Map[String, String]]
How can I get this Map collection defined in Spring config from a client code?
Many thanks
Regards.
Simply inject it somewhere: