title: how to get task in ActivitiEventListener
body: <p>I'm newbie of Activiti and java.I'm using activiti6 as flow engine.(spring boot 1.2.6)</p>
  <p>my target: when a task is created ,system will assign a backup candidate (dynamically) for this task automatically.
  I'm using ActivitiEventListener to monitor &quot;task created&quot; evnet.(&quot;TASK_CREATED&quot;)</p>
  <p>But it's stange. I do get event's executionId,but when I tried to get taskinfo by this executionId,it throwed exception (null).I checkd the &quot;activiti-admin&quot;,the process have not been created indeed.</p>
  <p><strong>then,if I continue the program,at last, the task (the same executionId I caught before) will be created in &quot;activiti-admin&quot; (and database)</strong></p>
  <p>if I used &quot;TASK_CREATED&quot; incorrectly ?How can I get task in listener?</p>
  <p>BTW: the first task in this process is a multi-instace(serial),I use &quot;startProcessInstanceByKey(ProcessKey, variables)&quot; to start the process.</p>
  <p>any idea will be appreciated.</p>
  <pre><code>@Component
  public class ComActivitiEventListener implements ActivitiEventListener, Serializable {
      protected TaskService taskService;
  
  @Override
  public void onEvent(ActivitiEvent event) {
      System.out.println(event.getType());
      if (&quot;TASK_CREATED&quot;.equals(event.getType().toString()))
      {
          //SpringContextUtils
          taskService = SpringContextUtils.getBean(TaskService.class);
          //here I can get excutionId
          String executionId = event.getExecutionId();
          // I can not get task here, it's null
          Task task = taskService.createTaskQuery().executionId(executionId).singleResult();
          String taskId=task.getId();
          taskService.addCandidateUser(taskId, &quot;backupuser&quot;);
      }
  }
  </code></pre>