public class ResourcesItemReader extends AbstractItemStreamItemReader<org.springframework.core.io.Resource>
Resourceinstances from an array. This can be used conveniently with a configuration entry that injects a pattern (e.g.
mydir/*.txt, which can then be converted by Spring to an array of Resources by the ApplicationContext.
ExecutionContextis not accurate in a multi-threaded environment, so do not rely on that data for restart (i.e. always open with a fresh context).
|Constructor and Description|
|Modifier and Type||Method and Description|
Increments a counter and returns the next
The resources to serve up as items.
close, getExecutionContextKey, setExecutionContextName, setName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void setResources(org.springframework.core.io.Resource resources)
resources- the resources
@Nullable public org.springframework.core.io.Resource read() throws java.lang.Exception
Resourceinstance from the input, or
nullif none remain.
nullif the data source is exhausted
ParseException- if there is a problem parsing the current record (but the next one may still be valid)
NonTransientResourceException- if there is a fatal exception in the underlying resource. After throwing this exception implementations should endeavour to return null from subsequent calls to read.
UnexpectedInputException- if there is an uncategorised problem with the input data. Assume potentially transient, so subsequent calls to read might succeed.
java.lang.Exception- if an there is a non-specific error.
public void open(ExecutionContext executionContext) throws ItemStreamException
public void update(ExecutionContext executionContext) throws ItemStreamException