The Activiti link monitors the tasklistener and injects the spring bean

Project address: The activiti-workflow
class implements TaskListener and uses the @Service annotation to ensure that this class can be automatically scanned by Spring.

@Service("taskExpressionService")
public class TaskExpressionService implements TaskListener {

    @Autowired
    private UserServiceImpl userService;

    @Override
    public void notify(DelegateTask delegateExecution) {
        String eventName = delegateExecution.getEventName();
        if ("create".endsWith(eventName)) {
            System.out.println("create=========");
        }else if ("assignment".endsWith(eventName)) {
            System.out.println("assignment========"+delegateExecution.getAssignee());
        }else if ("complete".endsWith(eventName)) {
            System.out.println("complete===========");
        }else if ("delete".endsWith(eventName)) {
            System.out.println("delete=============");
        }

    }
}

This configuration in the link can inject Spring beans.
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_34758074/article/details/90519737