Hi, all: Here is my case. I defined a userTask as following at first:
<userTask id="DataValidator" name="Data Validator">
<extensionElements>
<activiti:taskListener event="create" class="com.xxx.xxx.TaskAssignmentHandler">
<activiti:field name="candidateGroup" stringValue="QA" />
</activiti:taskListener>
</extensionElements>
</userTask>
Corresponding Java Code like following
@Service
public class TaskAssignmentHandler implements TaskListener{
@Autowired
private IdentityService identityService;
@Autowired
private WorkflowHistoryService historyService;
private Expression candidateGroup;
@Override
public void notify(DelegateTask task){
// do something
}
}
I found there is always nullpointerexception thrown out, because the class will be load into activiti by activiti on his own way, while other service is managed by spring. So, there will keep those service null pointer. Then I changed xml definition into following.
<userTask id="DataValidator" name="Data Validator">
<extensionElements>
<activiti:taskListener event="create" class="${taskAssignHandlerBean}">
<activiti:field name="candidateGroup" stringValue="QA" />
</activiti:taskListener>
</extensionElements>
</userTask>
And I add serialiable on to the class definition
@Service
public class TaskAssignmentHandler implements TaskListener, [color=#0000FF]Serializable[/color]{
And add one instance of TaskAssignmentHandler into instance of activiti. It still not work, because it requires any field of TaskAssignmentHandler implements Serializable. Ohhhh, it's unacceptable to modify those dependent class. So, there is any solution to handle the case?Thanks