Skip to content

no scope "step" available #7

@waffel

Description

@waffel

Hi,

I tried to little bit enhance your nice example with the possibility to set the CSV file location from outside (instead of using the classpath).

If I modify the code from the ItemReader to

@Bean
  @Scope("step")
  public ItemReader<Person> reader() {

and then running the commandline (without any further changes!) I get following error:

    ... 37 more
Caused by: java.lang.IllegalStateException: No context holder available for step scope
        at org.springframework.batch.core.scope.StepScope.getContext(StepScope.java:160)
        at org.springframework.batch.core.scope.StepScope.get(StepScope.java:99)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:338)
        ... 43 more

From the Spring documentation, the scope should be available (because of the Batch annotation).

Do you have any hint/idea whats the problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions