<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=j.betancourt" rel="nofollow">josef betancourt</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-2506?redirect=false" rel="nofollow">SPR-2506</a></strong> and commented</p>
<p dir="auto">Some complex properties do not follow the get/set JavaBean spec.  Thus, to wire these in with Spring is problematic.  Whether Spring should support non-javabean accessors is of course a question.   Anyway, there could be a way to explicitly specify these properties, for example:</p>
<p dir="auto">&lt;property method="addValue" value=doh"/&gt;<br>
or<br>
&lt;property method="addListener" ref=beanx"/&gt;</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0 RC3</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398050219" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/4961" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/4961/hovercard" href="https://github.com/spring-projects/spring-framework/issues/4961">#4961</a> Please improve BeanFactory support for containers &amp; collections (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=ben_hutchison" rel="nofollow">Ben Hutchison</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-230?redirect=false" rel="nofollow">SPR-230</a></strong>* and commented</p>
<p dir="auto">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.</p>
<p dir="auto">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.</p>
<p dir="auto">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:</p>
<p dir="auto">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;<br>
&lt;java version="1.4.2_03" class="java.beans.XMLDecoder"&gt;<br>
&lt;object class="java.util.ArrayList"&gt;<br>
&lt;void method="add"&gt;<br>
&lt;string&gt;item&lt;/string&gt;<br>
&lt;/void&gt;<br>
&lt;/object&gt;<br>
&lt;/java&gt;</p>
<p dir="auto">Evidently, it was recognized as an important feature as its present from the first release of the peristence mechanism.</p>
<p dir="auto">Consider what is <strong>not</strong> readily doable from XML without this feature:</p>
<ul dir="auto">
<li>Cannot create any Swing component heirarchies.</li>
<li>Cannot initialize custom collections (ie anything not a vanilla set/map/list impl), unless it provides a copy-constructor.</li>
<li>Cannot init arbritrary state on objects which do not observe the get/setXXX convention (and legacy code is littered with them).</li>
</ul>
<hr>
<p dir="auto"><strong>Affects:</strong> 1.0.2</p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/15243/SPR-230.patch" rel="nofollow">SPR-230.patch</a> (<em>137.30 kB</em>)</li>
</ul>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398070077" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/7195" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/7195/hovercard" href="https://github.com/spring-projects/spring-framework/issues/7195">#7195</a> Allow setting of properties without a javabean setter (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398070258" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/7222" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/7222/hovercard" href="https://github.com/spring-projects/spring-framework/issues/7222">#7222</a> Support JavaBean Eventing methods in Spring (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398072522" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/7488" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/7488/hovercard" href="https://github.com/spring-projects/spring-framework/issues/7488">#7488</a> "adder" injection in addition to "setter" (invoke addXX() instead of setXX()) (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398057408" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/5727" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/5727/hovercard" href="https://github.com/spring-projects/spring-framework/issues/5727">#5727</a> support "add"-style List injection (<em><strong>"is duplicated by"</strong></em>)</li>
</ul>
<p dir="auto">32 votes, 28 watchers</p>