我正面临此错误消息:
创建名为“jdbcWriter”的 bean 时出错,bean 初始化失败,无法将类型“$Proxy0”的属性值转换为属性“itemPreparedStatementSetter”所需的类型。
这是我的代码:
<beans:bean id="jdbcWriter"
class="org.springframework.batch.item.database.JdbcBatchItemWriter">
<beans:property name="dataSource" ref="dataSource"/>
<beans:property name="sql" value="update Trans_Tst set (amount) values (?)
where id= ?"/>
<beans:property name="itemPreparedStatementSetter"
ref="WriterSqlParameterSetter"/>
</beans:bean>
<beans:bean id="WriterSqlParameterSetter"
class="sa.com.anb.itg.dev.settlement.batch.WriterSqlParameterSetter" scope="step">
<beans:property name="amount" value="#{jobParameters[amount]}"/>
<beans:property name="id" value="#{jobParameters[id]}"/>
</beans:bean>
public class WriterSqlParameterSetter implements
ItemPreparedStatementSetter<transactionas>{
public void setValues(transactionas ts, PreparedStatement ps) throws SQLException {
ps.setDouble(1, ts.GetAmount());
ps.setInt(2, ts.GetID());
}
}
谁能帮我解决这个错误?这个错误是否与属性的值有关WriterSqlParameterSetter
?