Spring Batch
  1. Spring Batch
  2. BATCH-1588

Job Excecution Listener - XML Namespace parsing fails for methods named different to "beforeJob", "afterJob"

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.1.2
    • Component/s: Core
    • Labels:
      None

      Description

      The following XML configuration for a job listener does not work as the two configured methods are not called:

      -------- XML - Configuration --------
      <job id="...">
      ...
      <listener ref="pojoListener" before-job-method="before" after-job-method="after"/>
      </job>

      <bean id="pojoListener" class="com.example.MyListener"/>
      --------

      MyListener is a simple POJO and does not implement JobExecutionListener and has no annotated methods either.

      I've debugged the problem and it seems the offending code is in the private method
      AbstractListenerParser#getMethodNameAttributes

      That method returns

      {"beforeJob", "afterJob"}

      instead of the XML attribute names

      {"before-job-method", "after-job-method"}

      .

      The unit test "JobExecutionListenerParserTests" does not seem to test this case.

      I suspect that the same problem exists for Step Listeners as they share the same code base.

        Activity

        Hide
        Dave Syer added a comment -

        Fixed I think. Thanks for the detailed report. Actually it was a simple typo (using methodName instead of propertyName in the parser).

        Show
        Dave Syer added a comment - Fixed I think. Thanks for the detailed report. Actually it was a simple typo (using methodName instead of propertyName in the parser).

          People

          • Assignee:
            Dave Syer
            Reporter:
            Daniel Soneira
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 0.5d
              0.5d
              Remaining:
              Time Spent - 0.5h Remaining Estimate - 3.5h
              3.5h
              Logged:
              Time Spent - 0.5h Remaining Estimate - 3.5h
              0.5h