Spring : order of <map> tag

dictionary, java, spring

Solution

The default is `LinkedHashMap` - `MapFactoryBean` is used to create instances of `Map`. According to docs:

Simple factory for shared Map instances. Allows for central setup of Maps via the "map" element in XML bean definitions.

and its setTargetMapClass method:

Set the class to use for the target Map. Can be populated with a fully qualified class name when defined in a Spring application context. Default is a linked HashMap, keeping the registration order.

See Also: LinkedHashMap

so no need to use `<util:map>` here.

Problem

I need to Inject a Map to a bean property and when map entries are traversed it should return them in insertion order. In Java, this is similar to the LinkedHashMap. But as I can't find anything in spring documentation related to the ordering of tag, I'm not sure whether I can use to use it in this scenario. Can someone please let me know the whether I can use for this purpose. Many thanks

Original source