AnsweredAssumed Answered

Autowired object(userService) is null within CustomTaskListener code

Question asked by paiyyavj13 on May 5, 2017
Latest reply on May 8, 2017 by cjose



I am writing a custom TaskListener with the below code: I have hooked this TaskListener to Complete event of a User Task. I noticed that all the Autowired objects are null.

I am not efficient in Spring, am I missing a step by which I can properly Autowire these objects? Please assist!




Sample Code:

package com.activiti.extension.bean;


public class CustomTaskListener implements TaskListener {

private static final long serialVersionUID = 4218009794670685270L;

private static final Logger logger = LoggerFactory.getLogger(CustomTaskListener.class);

private HistoryService historyService;
private UserService userService;

public void notify(DelegateTask delegateTask) {
//...removed custom code for this post
//Here userService is null
User subTaskUser = userService.getUser(subTaskAssigneeId);