Sunday, February 22, 2009

Spring ME Supporting Map Configuration

As you may or may not know, Spring ME is aiming to be compliant with classic Spring. That is, a Spring ME configuration file is expected to work with classic Spring as well. However, it does remain a subset of classic Spring. There are some things not supported, and there are some things that will never be supported. One of the things missing so far was support for <map/> configuration. So, configuration files like these:

<?xml version="1.0" encoding="UTF-8"?>
<beans>

<bean id="indexHolder" class="me.springframework.di.spring.CourseIndexHolder">
<property name="index">
<map>
<entry key="coding">
<bean class="me.springframework.di.spring.Course">
<property name="topic" value="C++"/>
</bean>
</entry>
<entry key="modeling">
<bean class="me.springframework.di.spring.Course">
<property name="topic" value="UML"/>
</bean>
</entry>
</map>
</property>
</bean>

</beans>
...would fail. But the good news is: support for map configuration is has just been added to the trunk. So the above is perfectly valid if you happen to be using the version of the trunk.

Note that it is already compliant with classic Spring in many ways. So it does allow you to use keys based on beans instead of String literals, as an example. (See SPRINGME-4.) Share/Save/Bookmark

0 comments:

Blog Archive

About Me

My Photo
Wilfred Springer
View my complete profile

My Blog List