您好我正在使用activiti工作流程。我想在primefaces数据表中获得所有候选用户的所有任务。所以我正在编写一个本机查询来获取这些值,但我在managementService上有一个null值。我需要实现这个类吗?还是我需要导入一个库?我该怎么办?
@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;
答案 0 :(得分:2)
自动装配不适用于静态字段。删除static关键字并确保将接口的实现正确检测为Spring bean。