之前只在测试类写了一个类,而没有在根目录下写一个连接器一样的类
管图:
源码:
package com.wuyahui.activiti; import org.activiti.api.process.runtime.connector.Connector; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.context.annotation.Bean; @SpringBootApplication(exclude = SecurityAutoConfiguration.class) public class Actviti7DemoApplication { private Logger logger = LoggerFactory.getLogger(Actviti7DemoApplication.class); public static void main(String[] args) { SpringApplication.run(Actviti7DemoApplication.class, args); } @Bean public Connector testConnector() { return integrationContext -> { logger.info("以前叫代理,现在叫连接器被调用啦~~"); return integrationContext; }; } }
源码:
@RunWith(SpringRunner.class)
@SpringBootTest
public class Actviti7DemoApplicationTests {
@Autowired
private ProcessRuntimeprocessRuntime;
@Autowired
private TaskRuntimetaskRuntime;
@Autowired
private SecurityUtilsecurityUtil;
//
// /**
// * 查看流程定义
// */
@Test
public void contextLoads() {
securityUtil.logInAs("salaboy");
Page processDefinitionPage =processRuntime.processDefinitions(Pageable.of(0, 10));
System.out.println("可用的流程定义数量:" + processDefinitionPage.getTotalItems());
for (ProcessDefinition pd : processDefinitionPage.getContent()) {
System.out.println("流程定义:" + pd);
}
}
亲测有效哦,如果有疑问可以联系我哦。qq:2523039307