求Springboot2.0整合Activiti的demo或者教程

槿轩 发布于 01/20 16:37
阅读 519
收藏 0

求Springboot2.0整合Activiti的demo或者教程

加载中
0
caixueqing
caixueqing

我这有一个,给我你的邮箱

0
SpringBoot中文社区
SpringBoot中文社区

这种东西去Github搜,一抓一大把。

0
f
freezingsky

我自己有一个,用于生产项目, 不过, 是boot1.5的,使用上, 没啥子不同。

0
f
freezingsky

@Configuration
public class ActivitiConfig {

  @Value("${activiti.activityFontName:方正兰亭纤黑简体}")
  private String activityFontName;

  @Value("${activiti.labelFontName:方正兰亭纤黑简体}")
  private String labelFontName;

  @Value("${activiti.annotationFontName:方正兰亭纤黑简体}")
  private String annotationFontName;

  @Value("${activiti.db_schema_update:false}")
  private String dbSchemaUpdate;

  @Bean
  public ProcessEngineConfiguration processEngineConfiguration(@Autowired DataSource dataSource,
      @Autowired PlatformTransactionManager transactionManager, @Autowired EntityManagerFactory entityManagerFactory,
      @Autowired PostPurchasedProcessDiagramGenerator processDiagramGenerator) {

    SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();

    // 引擎的datasource配置
    config.setDataSource(dataSource);
    config.setTransactionManager(transactionManager);
    config.setDatabaseSchemaUpdate(dbSchemaUpdate);

    // JPA的事务管理不再由activiti引擎管理,应该交付 Spring 容器管理
    config.setJpaEntityManagerFactory(entityManagerFactory);
    config.setJpaHandleTransaction(false);
    config.setJpaCloseEntityManager(false);

    // 打开用于支持异步任务,用于支持时间定时任务器
    config.setAsyncExecutorActivate(true);
    config.setAsyncExecutorEnabled(true);
    config.setJobExecutorActivate(true);
    // 实现自定义图片处理器
    config.setProcessDiagramGenerator(processDiagramGenerator);

    // 设置流程图输出字体
    config.setLabelFontName(activityFontName);
    config.setActivityFontName(labelFontName);
    config.setAnnotationFontName(annotationFontName);

    // 必须在配置完成后调用
    config.buildProcessEngine();

    return config;
  }

  @Bean
  public ProcessEngineFactoryBean processEngine(@Autowired ProcessEngineConfiguration processEngineConfiguration) {
    ProcessEngineFactoryBean factory = new ProcessEngineFactoryBean();
    factory.setProcessEngineConfiguration((ProcessEngineConfigurationImpl) processEngineConfiguration);
    return factory;
  }

  @Bean
  public RepositoryService repositoryService(@Autowired ProcessEngineFactoryBean processEngine) {
    return processEngine.getProcessEngineConfiguration().getRepositoryService();
  }

  @Bean
  public RuntimeService runtimeService(@Autowired ProcessEngineFactoryBean processEngine) {
    return processEngine.getProcessEngineConfiguration().getRuntimeService();
  }

  @Bean
  public TaskService taskService(@Autowired ProcessEngineFactoryBean processEngine) {
    return processEngine.getProcessEngineConfiguration().getTaskService();
  }

  @Bean
  public HistoryService historyService(@Autowired ProcessEngineFactoryBean processEngine) {
    return processEngine.getProcessEngineConfiguration().getHistoryService();
  }

  @Bean
  public ManagementService managementService(@Autowired ProcessEngineFactoryBean processEngine) {
    return processEngine.getProcessEngineConfiguration().getManagementService();
  }

  @Bean
  public IdentityService identityService(@Autowired ProcessEngineFactoryBean processEngine) {
    return processEngine.getProcessEngineConfiguration().getIdentityService();
  }

}

 

0
在线笔记

ygitee github一大堆

返回顶部
顶部