my dog learned polymorphism*
The moose likes Other Application Frameworks and the fly likes configuring Maps in bean factory -> Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "configuring Maps in bean factory -> Spring" Watch "configuring Maps in bean factory -> Spring" New topic
Author

configuring Maps in bean factory -> Spring

Arun Prasath
Ranch Hand

Joined: May 23, 2007
Posts: 80
Buddies,

There is a difference between specifying key/value for Properties & Maps in bean factory XML file.

for example, in case of DI-ing the class which is a type of Properties, we use

<bean id="x" class="x.y">
<property name="someProperies">
<prop key="1"> one </prop>
<prop key="2"> two </prop>
</property>
</bean>

and for Maps, we use

<bean id="x" class="x.y">

<property name="someProperies">
<entry>
<key>
<value>something</value>
</key>
<value>Some value</value>
</entry>
</property>

</bean>

Why is there such difference in specifying properties, as they both are anyway belong to Map? can't we use any one for all Map types?
Could anyone answer me?

Thanks,
Arun

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: configuring Maps in bean factory -> Spring