May 20th, 2011, 10:03 AM
I have many jobs that are very similar between each other and I'm looking for a way to have an smaller XML.
The things that are shared among jobs are readers, processors, writers and one tasklet. Also some of the parameters for each of these beans are the same.
I thought about 4 approaches and 3 of them don't work...
1 - Using a postprocessor is not possible, because the job parser is not a public class.
2 - To add an XML extension seems to be a wrong thing, because I'm not adding any custom tags to the XML file.
3 - Using a PropertyOverrideConfigurer I can put default values into properties, but I have to define those values for each bean. So I'll have many repeated values.
4 - Using some kind of custom factory bean. These seems to be the only choice, but I don't know exactly how to plug it into the existing code.
Did anybody try to do this? Can somebody give tips or recommend resources on how to do it?
Let me know if the explanation is not clear enough.
Thanks in advance.
Jun 16th, 2011, 01:54 AM
Many people find the parent="" feature of bean definitions and <job/> and <step/> definitions useful. Without more information about the specific use case it is hard to see if that works for you or not. I didn't follow point 3 for instance. Maybe you could share some code samples? Custom step FactoryBean implementations work with <step parent=""/> as long as the factory extends one of the framework factories (FaultTolerantStepFactoryBean probably).
Tags for this Thread