Wiring maps and properties
Posted on 2011-05-04
I was reading folowing line and I did not understand clearly.
You can wire java util.Map collections in Spring using the <map> element. Map
collections are somewhat different than Lists, Sets. Each entry in a Map is
made up of a key and a value defined by the <entry> element:
The value of a map <entry>, just as with <list> and <set>, can be any valid property
Again, this includes <value>, <ref>, <list>, or even another <map>.
When wiring an <entry>, notice that the key attribute will also be a String.
This is a slight limitation over the full functionality of java.util.Map, which
allows any object to be the key of a map entry. However, this limitation doesn’t
often present a problem, as Maps are typically keyed with Strings anyway.
A java.util.Properties collection is the final type of collection that can be wired
in Spring. It is wired with the <props> element. Each element of a properties collection
is wired with the <prop> element.
In many ways, <props> works similarly to <map>. The big difference is that the
value of a <prop> entry is always a String, so there is no need to use the..
Any ideas, resources,sample code,links, highly appreciated. thanks in advance.