Activiti7+ SpringBoot+SpringMVC 开发

avatar
作者
猴君
阅读量:2

添加 Controller 类

代码如下:

@RestController public class MyController {     @Autowired     private ProcessRuntime processRuntime;     @Autowired     private TaskRuntime taskRuntime;     @Autowired     private SecurityUtil securityUtil; }  

实现任务完成

@RequestMapping("testTask")     public void testTask() {         Page<Task> taskPage = taskRuntime.tasks(Pageable.of(0, 10));         if (taskPage.getTotalItems() > 0) {             for (Task task : taskPage.getContent()) {                 taskRuntime.claim(TaskPayloadBuilder.claim().withTaskId(task.getId()).build());                 System.out.println("任务:" + task);                 taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(task.getId()).build());             }         }         Page<Task> taskPage2 = taskRuntime.tasks(Pageable.of(0, 10));         if (taskPage2.getTotalItems() > 0) {             System.out.println("任务:" + taskPage2.getContent());         }     } 

编写 SpringBoot 启动类

@SpringBootApplication(exclude = SecurityAutoConfiguration.class) public class ActvitiApplication { 	private Logger logger = LoggerFactory.getLogger(ActvitiApplication.class);    	public static void main(String[] args) { 		SpringApplication.run(ActvitiApplication.class, args); 	}  	@Bean 	public Connector testConnector() { 		return integrationContext -> { 			logger.info("我被调用啦~~"); 			return integrationContext; 		}; 	} } 

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!