Hi Marten
You aren't ... You are directly setting the value not a reference.
Yes, I know
This property (prototypeBeanName) must work with a value and not with a ref. Otherwise I get an exception.
I mean, If I use
Code:
...
<property name="lineMapper" >
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper" >
<property name="lineTokenizer" >
...
</property>
<property name="fieldSetMapper" >
<bean class="org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper" >
<property name="prototypeBeanName" ref="tasaCastigoInteres"/>
</bean>
</property>
</bean>
</property>
...
<bean id="tasaCastigoInteres"
class="com.manuel.jordan.domain.TasaCastigoInteres"
scope="prototype"
/>
I get
Code:
Caused by: java.lang.IllegalStateException:
Cannot convert value of type
[com.manuel.jordan.domain.TasaCastigoInteres] to required type [java.lang.String] for property 'prototypeBeanName':
no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:241)
I thought that could exists a way to turn around this with an inner bean like the follow.
Code:
<property name="fieldSetMapper" >
<bean class="org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper" >
<property name="prototypeBeanName" >
<bean
class="com.manuel.jordan.domain.TasaCastigoInteres"
scope="prototype"
/>
</property>
</bean>
</property>
But I get the same exception
So basically your bean 'tasaCastigoInteres' doesn't do anything...
No really
If I do
Code:
...
<property name="lineMapper" >
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper" >
<property name="lineTokenizer" >
...
</property>
<property name="fieldSetMapper" >
<bean class="org.springframework.batch.item.file.mapping.BeanWrapperFieldSetMapper" >
<property name="prototypeBeanName" ref="tasaCastigoInteres"/>
</bean>
</property>
</bean>
</property>
...
<!--
<bean id="tasaCastigoInteres"
class="com.manuel.jordan.domain.TasaCastigoInteres"
scope="prototype"
/>
-->
I get
Code:
Caused by:
org.springframework.beans.factory.NoSuchBeanDefinitionException:
No bean named 'tasaCastigoInteres' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:553)
I hope you see now my point.