I'm wondering why the ClassPathXmlJobRegistry refuses to load an application context when it defines multiples beans that are instances of Job.
What's the rationale behind this restriction?
Thanks,
Philippe
I'm wondering why the ClassPathXmlJobRegistry refuses to load an application context when it defines multiples beans that are instances of Job.
What's the rationale behind this restriction?
Thanks,
Philippe
As far as I know there is no such restriction. Are you using CommandLineJobRunner (up to 2.0.1 it was fussy about the number of jobs in its context)?
This is from the ClassPathXmlJobRegistry#afterPropertiesSet method:
where "resource" is the application context XML file. This is the test that I'm wondering about. Why would it refuse an application ctx with more than one Job bean?Code:String[] names = context.getBeanNamesForType(Job.class); if (names.length > 1) { throw new DuplicateJobException("More than one Job found for resource: [" + resource + "]"); }
I don't know. That's why I removed that test in 2.0.2.
Indeed! That's great thanks.