Uploaded image for project: '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
    • Status: Resolved
    • Priority: 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.

        Attachments

          Activity

            People

            • Assignee:
              david_syer Dave Syer
              Reporter:
              daniel.soneira 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