嗨,我正在使用activiti工作流。我想在primefaces数据表中获取所有任务以及所有候选用户。因此,我正在编写一个本机查询以获取这些值,但是在managementService上具有空值。我是否需要实现此类?是否需要导入一个库?我应该如何进行?
@Autowired
private static ManagementService managementService;
public static List<Task> retrieveAllTasks(){
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
TaskService taskService = processEngine.getTaskService();
String taskTable = managementService.getTableName(TaskEntity.class);
String identityLinkTable = managementService.getTableName(IdentityLinkEntity.class);
List<Task> groupTasks = taskService.createNativeTaskQuery().sql("select _TASK.*" +
" from " + taskTable + " _TASK" +
" join " + identityLinkTable + " _LINK on _TASK.ID_ = _LINK.TASK_ID_" +
" where _LINK.TYPE_ = 'candidate'").list();
return groupTasks;
最佳答案
自动装配不适用于静态字段。删除static关键字,并确保已正确将接口的实现检测为Spring bean。