Wednesday, October 14, 2015

Field or property 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - Spring Batch

This Error happens when you are trying to retrieve a Job Execution parameter and inject it into a Bean. The bean can be anything a Task let, or a StatmentSetter the error can happen.

E.g Implementation
<bean id="flatFileItemReader" scope="step"
    <property name="resource" value="#{jobParameters[]}" />

The error is because of the Scope parameter missing

Using a scope of Step is required in order to use late binding since the bean cannot actually be instantiated until the Step starts, which allows the attributes to be found. Because it is not part of the Spring container by default, the scope must be added explicitly.

Check out the Documentation here ..

No comments:

Post a Comment