Bug 4137

Summary: In the RI, the applyTo attribute in the chunk properties doesn't work as expected
Product: jbatch Reporter: jfullam
Component: sourceAssignee: cvignola
Status: CLOSED FIXED    
Severity: normal CC: issues, kmukher
Priority: P5    
Version: 1   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS   

Description jfullam 2012-09-20 15:29:08 UTC
When applyTo property is used, the RI actually applies the property to all artifact types within the chunk type step (reader, writer, and processor).
Comment 1 cvignola 2012-10-05 18:31:32 UTC
This is an RI/spec sychronization issue.  The applyTo attribute was removed in the early draft review copy of the spec.  #{<artifact-name>['<property-name>']} (section is the replacement fo applyTo.
Comment 2 kmukher 2012-10-09 14:11:52 UTC
The #{<artifact-name>['<property-name>']} syntax seems to imply that the source of the property is from <artifact-name> instead of the target of the property injection. 

It seems to be more natural and readable to express the target of a property injection through an XML attribute instead of through an expression language. 
If the property target is part of the expression language we will have to parse the EL twice or store the target separately as a hidden attribute of the property after the initial parsing only to retrieve that information again later; so why not just separate it up front and make it a visible attribute?

In section 5.8.1 of the spec there is an example similar to the one below. There the target is the artifact type instead of the artifact name. I don't really have much of preference either way, but I believe the general convention is to target a property to a bean/artifact id.

<chunk reader="MyReader" writer="MyWriter>
    <properties merge="true">
        <property name="globalFile" value="/tmp/golbal.txt" />
        <property name="infile" value="/tmp/input.txt" target="reader,writer"/>
        <property name="outfile" value="/tmp/output.txt" target="writer"/>
Comment 3 cvignola 2013-01-16 16:06:10 UTC
applyTo has been dropped from the spec