-
Jan 27th, 2010, 10:50 AM
#1
Get spring job params
Hi
Can anyone guide me as to how to get the job parametres whilst I am writing my data in a custom writer class
Thanks
-
Jan 28th, 2010, 03:18 AM
#2
Greetings
You can get them by adding a new listener on job
public class ItemJobListener implements JobExecutionListener {
public void afterJob(JobExecution jobExecution) {
}
public void beforeJob(JobExecution jobExecution) {
String myParamValue = jobExecution.getJobInstance().getJobParameters()
.getString("myParamKey");
}
}
where the job is launched with myParamKey=myParamValue
if you want to read parameters from application context.xml
you can use :
#{jobParameters[myParamKey]} as :
<property name="resource" value="#{jobParameters[myParamKey]}" />
and don't forget to make the bean step scoped
Hope this can help
Abdel
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules