Issue 1:
john@johnandkerri.com opened SPR-4164 and commented

I seems that form:checkboxes and form:radiobuttons are still broken. They still use toString and not the registered property editor to generate the value.

form:select works properly, and form:checkboxes and form:radiobuttons should work just like it.

For example:

<form:select path="interests" multiple="true">

<form:options items="${interests}" itemLabel="name" itemValue="id" />

</form:select>

The above works great. path="interests" is the complete set of things a person may be interested in and items="${interests}" are the set of things the given person is interested in.

However, checkboxes and radiobuttons like so:

<form:checkboxes path="interests" items="${interests}" itemLabel="name" />

<form:checkboxes path="interests" items="${interests}" itemLabel="name" itemValue="id" />

does not work. Specifically, if I leave itemValue blank, the values are correctly bound and the right ones checked, but the tag uses toString to generate the value instead of calling the property editor, so when I save of, course, the property editor can't convert the value (unless my toString method returns the same thing as my custom property editor, which is not a good solution).

If I do itemValue="id", the values are not properly bound (the right check boxes are not checked.

The same issue is true with the single versions form:checkbox and form:radiobutton.

<c:forEach var="interest" items="${interests}">

<frm:checkbox path="interests" value="${interest}" />

<c:out value="${interest.name}" />

</c:forEach>

The above would work if the tag used the registered property editor to generate the value, but instead it uses toString (and again, if your toString returns the same thing as your property editor, it works).

This issue relates to these other issues.

Allow form:checkbox to create multiple boxes based on a collection of values:

http://opensource.atlassian.com/projects/spring/browse/SPR-3882

Enable usage of custom PropertyEditor for collection element for form:select bound to collection

http://opensource.atlassian.com/projects/spring/browse/SPR-3654

Affects: 2.5 final

Issue Links:

#8335 Enable usage of custom PropertyEditor for collection element for form:select bound to collection ("duplicates")

#9079 AbstractCheckedElementTag should properly pre-check items from a map or collection item source

Issue 2:
Haroon Rafique opened SPR-4324 and commented

The version bump from 2.5 to 2.5.1 breaks component scanning for me. Symptoms are that lots of beans annotated with @Component are being skipped for inclusion as beans. After digging through the code, I think the following commit is the culprit:

http://fisheye1.cenqua.com/changelog/springframework?cs=MAIN:jhoeller:20080107164524

The commit message says:

added "getEnclosingClassName()", "hasEnclosingClass()" and "isIndependent()" methods to ClassMetadata interface; ClassPathScanningCandidateComponentProvider ("context:component-scan") ignores non-static inner and local classes

I am not sure why beanDefinition.getMetadata().isIndependent() is returning false for my classes. The scenario is as follows:

MyBroker has @Component annotation. MyBroker uses a class MyService (regular instantiation) using something like:

MyService service = new MyService()

MyService, in turn, is the class which DOES have a local inner class. I think the bug is in identifying MyBroker as having an inner class. It should not identify MyBroker as having an inner class (since it doesn't have one).

ClassMetaDataReadingVisitor.java has the following method:

public boolean isIndependent() {
return (this.enclosingClassName == null || this.independentInnerClass);
}

In that method, while trying to see if MyBroker is a candidate, enclosingClassName is set to MyService.

I think this needs a quick fix.

Affects: 2.5.1

Attachments:

spring-2.5.1-component-scanning-inner-class-bug-SPR-4324.zip (4.92 kB)

Issue Links:

#9134 Weird autowiring bug ("is duplicated by")

#9029 context:annotation-config skips classes using inner classes in 2.5.1 ("is duplicated by")

#9204 bug in context:component-scan when class have inner classes ("is duplicated by")

#9017 Classes with Inner classes are not recognized as independent classes themselves ("is duplicated by")

#9363 @Component annotated class that contains a private non-static inner class not considered as candidate component because beanDefinition.getMetadata().isIndependent() returns false ("is duplicated by")

#9136 Component-scan does not work correctly for annotated service SimpleJdbcClinic in sample 'petclinic'