SpringBoot整合Activiti

SpringBoot集成Activiti7

SpringBoot版本使用2.7.16

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.16</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

导入数据库及activiti相关依赖

>
    >org.springframework.boot>
    >spring-boot-starter>
>
>
    >mysql>
    >mysql-connector-java>
    >8.0.23>
>
>
    >org.springframework.boot>
    >spring-boot-starter-jdbc>
>
>
    >org.activiti>
    >activiti-spring-boot-starter>
    >7.1.0.M6>
>

activiti-spring-boot-starter默认集成Spring Security,此处先禁用

import org.activiti.core.common.spring.identity.config.ActivitiSpringIdentityAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication(exclude = {ActivitiSpringIdentityAutoConfiguration.class})
public class ActivitiApplication {

    public static void main(String[] args) {
        SpringApplication.run(ActivitiApplication.class, args);
    }

}

添加UserGroupManager配置

import org.activiti.api.runtime.shared.identity.UserGroupManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class ActivitiConfiguration {

   @Bean
   public UserGroupManager userGroupManager() {
       return new UserGroupManager() {
           @Override
           public List<String> getUserGroups(String s) {
               return new ArrayList<>();
          }
           @Override
           public List<String> getUserRoles(String s) {
               return null;
          }
           @Override
           public List<String> getGroups() {
               return null;
          }
           @Override
           public List<String> getUsers() {
               return null;
          }
      };
  }
}

启动服务,MySQL中生成25张表。
SpringBoot整合Activiti_第1张图片

你可能感兴趣的:(Java,SpringBoot,工作流,spring,boot,后端,java)