0 Replies Latest reply on Mar 30, 2010 6:20 PM by spincycle

    jBPM 4.3 Spring bean as event listener

      I have followed the recommendations in the developer's guide for doing Spring integration with jBPM 4.3. My application deploys to JBoss 5, and the server starts cleanly.

       

      Here's my issue: I want my processes to be able to use Spring beans for event listeners. The relevant process code is:

      <process name="speechrec" ...>
          <on event="start">
              <event-listener expr="#{processListener}" >
                  <field name="eventType">
                      <string value="start"/>
                  </field>
              </event-listener>
          </on>

      The bean id "processListener" is defined in my Spring config, and the expression #{processListener} is evaluated to the correct class name, but the class is instantiated by jBPM instead of Spring. So the bean's Spring properties are not injected, so of course I get NPE's whenever they are used. I was hoping the "expr" attribute would behave like Spring's "ref" attribute and make use of an existing bean if there is one.

       

      Is there any way to get what I want?  Does it mean that only jBPM beans can be used as event listeners?