Bug 4366 - @BatchProperty only way to inject properties into an artifact?
@BatchProperty only way to inject properties into an artifact?
Status: CLOSED WORKSFORME
Product: jbatch
Classification: Unclassified
Component: source
1
PC Mac OS
: P5 enhancement
: ---
Assigned To: cvignola
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-21 23:33 UTC by chrisschaefer
Modified: 2013-01-16 17:44 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description chrisschaefer 2012-11-21 23:33:03 UTC
This in a way is similar to the @Named requirement (http://java.net/bugzilla/show_bug.cgi?id=4304). It seems the only way to inject batch properties into an artifact is by marking fields with @BatchProperty.

The 6.3.1 @BatchProperty example shows:

@Named
public class MyItemReaderImpl {
    @BatchProperty String fname="/tmp/input.txt";
}

This seems somewhat limiting as for example w/ Spring the wiring is done on the bean/artifact itself. So for instance in Spring Batch MyItemReaderImpl's fname value could get wired via XML through a constructor argument, setters or on fields (additionally) with annotations along with type conversion, bean scoping, etc. http://java.net/bugzilla/show_bug.cgi?id=4353 also raises a good point on String only properties and manual conversion.
Comment 1 chrisschaefer 2012-11-21 23:40:14 UTC
I could open another issue if needed, but the same seems to apply for BatchContext.
Comment 2 cvignola 2012-12-07 00:05:57 UTC
In version 1 of this spec,  yes @BatchContext and @BatchProperty are the only way.  There is room for future improvement,  but we need to stay focused on essentials to get version 1 out.