Resolution: Won't Fix
Affects Version/s: 1.0.2
Fix Version/s: None
Last commented by a User:true
Objects that contain other objects (common examples include Swing Containers and the Collections classes) frequently cannot have their initial state specified through setting javabeans properties alone.
This is a request for the spring core to include extensions to the syntax of the applicationContext.xml to allow such objects to be setup completely from XML. Some reasonably conveinient syntax is needed that allows methods like "add()" to be invoked on the bean at construction time. Ideally, I think the syntax should allow any arbritrary methods to be called on a bean during preparation.
There is a clear precendent to be found in the design of the java.beans.XMLEncoder/Decoder classes, designed to support long term bean perisstence. Consider the extract below generated by XML-serializing a List:
<?xml version="1.0" encoding="UTF-8" ?>
<java version="1.4.2_03" class="java.beans.XMLDecoder">
Evidently, it was recognized as an important feature as its present from the first release of the peristence mechanism.
Consider what is not readily doable from XML without this feature:
- Cannot create any Swing component heirarchies.
- Cannot initialize custom collections (ie anything not a vanilla set/map/list impl), unless it provides a copy-constructor.
- Cannot init arbritrary state on objects which do not observe the get/setXXX convention (and legacy code is littered with them).