Интересно, как передать параметр bean.xml.Параметры прохода в данных весны
Если я пишу, как это в bean.xml, он работает, как ожидалось
<bean id="notificationReader" class="org.springframework.batch.item.database.JdbcCursorItemReader" scope="step">
<property name="dataSource" ref="dataSource" />
<property name="sql" value="SELECT r.EDCBATCH_OPEN_DATETIME As openDate FROM rev_acq_edcbatch r WHERE r.EDCBATCH_STATUS ='A'" />
<property name="rowMapper">
<bean name = "campaignMapper" class="rh.com.app.domain.AgingMapper">
</bean>
</property>
</bean>
Но если я пишу, как это, я получаю ошибку
<property name="sql" value="SELECT r.EDCBATCH_OPEN_DATETIME As openDate FROM rev_acq_edcbatch r WHERE r.EDCBATCH_STATUS = #{jobParameters['edcbatchStatus']}" />
Мой bean.xml
<task:scheduled-tasks>
<task:scheduled ref="agingScheduler" method="run" cron="*/5 * * * * *" /><!--0 0 5 * * *-->
</task:scheduled-tasks>
<!-- class = bean-->
<bean id="agingScheduler" class="rh.com.ap.AgingScheduler">
<property name="jobLauncher" ref="jobLauncher" />
<property name="agingJob" ref="agingJob" />
<property name="mailClient" ref="mailClient" />
</bean>
<batch:job id="agingJob">
<batch:step id="step1" next = "emailFile" >
<batch:tasklet transaction-manager="transactionManager">
<batch:chunk reader="notificationReader" writer="notificationWriter" processor="notificationProcessor" commit-interval="10" />
</batch:tasklet>
</batch:step>
<batch:step id="emailFile">
<batch:tasklet ref="emailTasklet" />
</batch:step>
<batch:listeners>
<batch:listener ref="jobListener" />
</batch:listeners>
</batch:job>
AgingScheduler
JobParametersBuilder builder = new JobParametersBuilder();
builder.addDate("date", new Date());
builder.addString("fileName", "AgingReporting_" + PropertiseUtil.settlementDateyyyyMMdd());
builder.addString("edcbatchStatus","A").toJobParameters();
Ошибка
Job failed with following exceptions
exception :Failed to initialize the reader
Спасибо Marc :). –