שלה יהושוע opened SPR-16392 and commented
Given any class
public class UnitTestData {
public String vin, model;
//... setters ....
}
Within the spring context config src/testresources/telematics/call-test-cfg.xml
<beans>
<util:list id="datalist" value-type="UnitTestData"
<bean id="data1" class="UnitTestData">
<property name="vin" value="jtdx 0000 1234 4567 9"/>
</bean>
<bean id="data2" class="UnitTestData">
<property name="vin" value="jtdx 3333 1234 4567 1"/>
</bean>
<//uti:list>
</beans>
Referenced in a main code body
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("telematics/call-test-cfg.xml")
public class VehicleValidation{
@Inject List<UnitTestData> datalist;
}
- Ist, it doesn't matter if value-type is declared in list of beans declaration in config
- Then the generic declaration, List\
datalist is not recognised and produces run error. Instead, I would have to declare as non-generic and then cast each item.
Affects: 4.3.8
Comment From: snicoll
Thanks for the report. The target type is meant to be used for type conversion if necessary. Lists created in XML like this are not expected to carry full generic information.