Bugzilla – Full Text Bug Listing
|Summary:||Functionality for instance creation using batch.xml|
Description mminella 2013-01-18 14:58:34 UTC
In section 7.7.1 on page 89, the spec outlines the batch.xml as a way to map names used in the Job XML to class types. While the spec is still missing the XSD (as noted in issue 4174), how does the batch.xml file provide enough information for a non DI container to create the required objects? The spec (from what I can find) does not require no arg constructors for the classes defined in the batch.xml and provides no way from what I can see to manage object dependencies in any other way. While I understand how this will work in a DI scenario (With Spring for example, the names in the Job XML will refer to bean ids), I don't see how the batch.xml provides enough information to create the artifacts needed for batch processing.
Comment 1 cvignola 2013-01-23 18:37:42 UTC
Section 7.7.1 while not an XSD, shows the complete syntax of batch.xml: <batch-artifacts xmlns="http://jcp.org.batch/jsl"> <ref id="<reference-name>" class="<impl-class-name>" /> </batch-artifacts So it's a simple map of logical name to implementation class name. The default ctor is assumed. The spec needs to say that.
Comment 2 mminella 2013-01-23 21:34:09 UTC
How are dependencies handled? Since the classes defined by the batch.xml are instantiated via the batch runtime via a default constructor and there is no additional hook to perform any other type of initialization, there needs to be some way to handle object dependencies. What am I missing?
Comment 3 cvignola 2013-01-24 02:54:18 UTC
The spec doesn't require DI. So the way you handle dependencies is dependent on your runtime environment. If know you can count on DI, you can use DI for dependencies. If you're using plain SE, you have to instantiate your own dependent objects.