Open spring-projects-issues opened 10 years ago
Mahmoud Ben Hassine commented
I created a parent job definition referencing the listener and had all my actual batch job definitions extend that. However, the configuration of the listener differs slightly for some of the batch jobs
Defining an abstract parent job definition is the way to go. However, why would we need a job meta data attribute instead of overriding the listener definition for jobs that slightly differ from the abstract one?
Erwin Vervaet opened BATCH-2286 and commented
Spring Web Flow allows you to annotate a flow definition with static metadata attributes (http://www.springframework.org/schema/webflow/spring-webflow-2.4.xsd). For instance:
A similar feature would also be useful for a Spring Batch job.
I ran into a use-case for this just yesterday. I have a JobExecutionListener that I want to apply to all batch jobs in my application. Consequently I created a parent job definition referencing the listener and had all my actual batch job definitions extend that. However, the configuration of the listener differs slightly for some of the batch jobs. Using a job metadata attribute I would have been able to annotate the job definition and the listener could have picked up the annotation. Since that is currently not possible I ended up adding a non-identifying job parameter that the listener can inspect.
No further details from BATCH-2286