Spring Batch : Field or property 'stepExecutionContext' cannot be found

emeraldjava

I have the following spring batch job configuration. There is a single reader which then passes details to a composite writer which has two specific writers. Both writers share a common parent and need to use the same JobId for the INSERT operations they execute.

<bean id="job" parent="simpleJob">
    <property name="steps">
        <list>
            <bean parent="simpleStep">
                <property name="itemReader" ref="policyReader"/>    
                <property name="itemWriter" ref="stagingCompositeWriter"/>
            </bean>
        </list>
    </property>
</bean>

<bean id="stagingCompositeWriter" class="org.springframework.batch.item.support.CompositeItemWriter">
    <property name="delegates">
        <list>
            <ref bean="stagingLoadWriter"/>
            <ref bean="stagingPolicyWriter"/>
        </list>
    </property>
</bean>

<bean id="abstractStagingWriter" class="a.b.c.AbstractStagingWriter" abstract="true">
    <property name="stepExecution" value="#{stepExecutionContext}"/>
    <property name="hedgingStagingDataSource" ref="hedgingStagingDataSource"/>
</bean>

<bean id="stagingLoadWriter" class="a.b.c.StagingLoadWriter" parent="abstractStagingWriter"/>

<bean id="stagingPolicyWriter" class="a.b.c.StagingPolicyWriter" parent="abstractStagingWriter"/>

When i run my code i get the following error

Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'stepExecutionContext' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'
at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:208)
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:72)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:93)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:88)
at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:139)

I have tried setting the scope="step" in various place but to no avail. Any suggestions?

Haim Raman

You can access the stepExecutionContext only within a bean defined in the scope="step". Change your bean definition to

<bean id="stagingLoadWriter" scope="step" class="a.b.c.StagingLoadWriter" parent="abstractStagingWriter" />

<bean id="stagingPolicyWriter" scope="step" class="a.b.c.StagingPolicyWriter" parent="abstractStagingWriter"/>

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Spring / Thymeleaf: Property or field cannot be found on null, but still rendering

分類Dev

Spring / Thymeleaf: Property or field cannot be found on null, but still rendering

分類Dev

Spring / Thymeleaf: Property or field cannot be found on null, but still rendering

分類Dev

Spring Batch:フィールドまたはプロパティ 'stepExecutionContext'が見つかりません

分類Dev

EL1008E: Property or field 'content' cannot be found on object of type 'java.util.ArrayList' - maybe not public or not valid?

分類Dev

Spring batch FlatFileItemWriter writing model containing a property of List type

分類Dev

validate field length while reading csv file in spring batch

分類Dev

Register-PsRepository : The property 'Name' cannot be found on this object

分類Dev

Django @property calculating a model field: FieldError: Cannot resolve keyword

分類Dev

Spring Data with QueryDslPredicateExecutor no property findAll found for type error

分類Dev

Spring Data with QueryDslPredicateExecutor no property findAll found for type error

分類Dev

Spring Data with QueryDslPredicateExecutor no property findAll found for type error

分類Dev

Spring BatchPartitioningはitemReaderにstepExecutionContextパラメーターを挿入します

分類Dev

How to fix "Field ... required a bean of type ... that could not be found" exception Spring Boot

分類Dev

Cannot construct Spring webClient due to java.lang.IllegalStateException: No suitable default ClientHttpConnector found

分類Dev

Spring Batch + Spring Boot + Couchbase

分類Dev

CallableTaskletAdapter Spring Batch

分類Dev

Spring Batch Writer

分類Dev

Spring Batch FlatFile Formatting

分類Dev

Spring Batch MultiLineItemReader with MultiResourcePartitioner

分類Dev

Transaction management with Spring Batch

分類Dev

Spring Batch : custom ItemReader

分類Dev

BeautifulSoup: Table cannot be found

分類Dev

ActivityMainBindingImpl cannot be found

分類Dev

Cannot read property 'then' of undefined

分類Dev

Vuejs Cannot destructure property

分類Dev

Cannot access property in tableviewcell

分類Dev

Spring Boot + Spring Batch + Spring JPA

分類Dev

Flutter - TextField "textAlign" property not found

Related 関連記事

  1. 1

    Spring / Thymeleaf: Property or field cannot be found on null, but still rendering

  2. 2

    Spring / Thymeleaf: Property or field cannot be found on null, but still rendering

  3. 3

    Spring / Thymeleaf: Property or field cannot be found on null, but still rendering

  4. 4

    Spring Batch:フィールドまたはプロパティ 'stepExecutionContext'が見つかりません

  5. 5

    EL1008E: Property or field 'content' cannot be found on object of type 'java.util.ArrayList' - maybe not public or not valid?

  6. 6

    Spring batch FlatFileItemWriter writing model containing a property of List type

  7. 7

    validate field length while reading csv file in spring batch

  8. 8

    Register-PsRepository : The property 'Name' cannot be found on this object

  9. 9

    Django @property calculating a model field: FieldError: Cannot resolve keyword

  10. 10

    Spring Data with QueryDslPredicateExecutor no property findAll found for type error

  11. 11

    Spring Data with QueryDslPredicateExecutor no property findAll found for type error

  12. 12

    Spring Data with QueryDslPredicateExecutor no property findAll found for type error

  13. 13

    Spring BatchPartitioningはitemReaderにstepExecutionContextパラメーターを挿入します

  14. 14

    How to fix "Field ... required a bean of type ... that could not be found" exception Spring Boot

  15. 15

    Cannot construct Spring webClient due to java.lang.IllegalStateException: No suitable default ClientHttpConnector found

  16. 16

    Spring Batch + Spring Boot + Couchbase

  17. 17

    CallableTaskletAdapter Spring Batch

  18. 18

    Spring Batch Writer

  19. 19

    Spring Batch FlatFile Formatting

  20. 20

    Spring Batch MultiLineItemReader with MultiResourcePartitioner

  21. 21

    Transaction management with Spring Batch

  22. 22

    Spring Batch : custom ItemReader

  23. 23

    BeautifulSoup: Table cannot be found

  24. 24

    ActivityMainBindingImpl cannot be found

  25. 25

    Cannot read property 'then' of undefined

  26. 26

    Vuejs Cannot destructure property

  27. 27

    Cannot access property in tableviewcell

  28. 28

    Spring Boot + Spring Batch + Spring JPA

  29. 29

    Flutter - TextField "textAlign" property not found

ホットタグ

アーカイブ