У меня нижеуказанная xml пакетная конфигурация, но задания не выполняются. Я не вижу никаких ошибок при запуске приложения, я подозреваю, что есть неправильная конфигурация, которую я не могу выяснить. Ниже приведена конфигурация:
Приложение. java выглядит следующим образом:
@SpringBootApplication(exclude= {ValidationAutoConfiguration.class, WebMvcAutoConfiguration.class })
@ImportResource("classpath:/application.xml")
@ComponentScan(value = "com.abc.xyz.app.configuration") //retrives dataSource
@EnableScheduling
@EnableTransactionManagement
public class Application extends SpringBootServletInitializer{
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
приложение. xml
<import resource="classpath:/app-batch-context.xml"/>
<import resource="classpath:/job_1.xml"/>
<import resource="classpath:/schdeuler_1.xml"/>
app-batch-context . xml имеет следующее содержимое.
<bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry"/>
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="appJobRepository"/>
</bean>
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.JobExplorerFactoryBean">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="jobOperator" class="org.springframework.batch.core.launch.support.SimpleJobOperator">
<property name="jobExplorer" ref="jobExplorer"/>
<property name="jobLauncher" ref="jobLauncher"/>
<property name="jobRepository" ref="appJobRepository"/>
<property name="jobRegistry" ref="jobRegistry"/>
</bean>
<bean id="appJobRepository" class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="lobHandler" ref="lobHandler"/>
<property name="serializer" ref="xStreamExecutionContextStringSerializer"/>
<property name="transactionManager" ref="transactionManager"/>
</bean>
<bean id="xStreamExecutionContextStringSerializer" class="org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer"/>
<bean id="lobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler"/>
<!-- Wrapper bean to hold the applicationcontext, and make it accessible to all the objects-->
<bean id="appContext" class="com.app.core.AppContextInitializer"></bean>
<bean id="stepListner" class="com.app.core.step.APPStepExceutionListner"></bean>
<bean id="jobListner" class="com.app.core.job.APPJobExecutionListner"></bean>
<!-- abstract base Job, all jobs will extend this Job -->
<batch:job id="APPBaseJob" abstract="true" job-repository="appJobRepository">
<batch:listeners>
<batch:listener ref="jobListner"/>
</batch:listeners>
</batch:job>
<!-- abstract base Job, all the steps will extend this step-->
<batch:step id="abstractStep" abstract = "true">
<batch:listeners>
<batch:listener ref ="stepListner"/>
</batch:listeners>
</batch:step>
job_1. xml
<batch:job id="myTestJob" parent="APPBaseJob">
<batch:step id="myTestPreProcessorStep" next="myTestStopProcessingDecider">
<batch:tasklet ref="myTestPreProcessorTasklet"/>
</batch:step>
<batch:decision id="myTestStopProcessingDecider" decider="stopProcessingDecider">
<batch:next on="CONTINUE" to="myTestFileNameValidatorStep" />
<batch:end on="COMPLETED"/>
</batch:decision>
.
.
.
<batch:step id="myTestCustomInputValidatorStep" next="myTestTransformStep">
<batch:tasklet ref="myTestCustomInputValidatorTasklet"/>
</batch:step>
<batch:step id="myTestTransformStep" parent="abstractStep" next="myTestFileTransferStep">
<batch:tasklet>
<batch:chunk reader="myTestFileItemReader" processor="myTestXmlProcessor" writer="myTestItemWriter"
commit-interval="#{stepExecutionContext.get('APPBATCHCONTEXT').appBatch.toBeProcessedSize}"/>
</batch:tasklet>
</batch:step>
<batch:step id="myTestFileTransferStep" next="myTestPostProcessorStep">
<batch:tasklet ref="myTestFileTransferTasklet"/>
</batch:step>
</batch:job>
<!-- File Reader -->
<bean class="com.app.core.reader.v1.APPJaxbFileEntityReader" id="myFileItemReader" scope="step">
<property name="batchContext" value="#{stepExecutionContext.get('APPBATCHCONTEXT')}"></property>
<property name="packageName" value="com.abc.jaxb.xyz.extract"></property>
</bean>
<!-- File Content Writer-->
<bean class="com.app.core.writer.v1.APPXmlJaxbItemWriter" id="myItemWriter" scope="step">
<property name="batchContext" value="#{stepExecutionContext.get('APPBATCHCONTEXT')}"></property>
<property name="packageName" value="com.abc.jaxb.xyz.extract"></property>
</bean>
<bean id="myXmlProcessor" class="com.abc.app.xyz.customprocessor.XMLDocumentProcessor" scope="step">
<property name="batchContext" value="#{stepExecutionContext.get('APPBATCHCONTEXT')}"></property>
<property name="somePropertyDataService" ref="somePropertyDataService"/>
</bean>
<bean id="myFileTransferTasklet" class="com.abc.xyz.customsender.mySenderTasklet">
<property name="stepSkipDeciders" ref="skipStepDeciders"></property>
<property name="router" ref="myRouter"></property>
</bean>
<bean class="com.abc.xyz.app.customsender.ABCRouter"
id="myRouter"></bean>
<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager" />
Планировщик имеет следующую информацию: Использование пользовательского JobLauncher, но, в свою очередь, использует org.springframework.batch.core.launch.JobLauncher для запуска заданий.
<task:scheduler id="myScheduler" pool-size="1"/>
<bean id="myLauncher" class="com.abc.xyz.job.APPJobLauncher">
<property name="jobCode" value="abc"></property>
</bean>
<task:scheduled-tasks scheduler="abcScheduler">
<task:scheduled ref="myLauncher" method="startJob" cron="${abcFreq}"/>
</task:scheduled-tasks>
Частота заданий будет в файле свойств с выражением cron * * / 5 * * * *
Пожалуйста, дайте мне знать, если есть какой-либо указатель, который я должен проверить.
Обновление при загрузке с 1.5.x до 2.2.x
Заранее спасибо.