SpringBoot整合Activiti學習(一)
前言
只有學到手的才是自己的,加油,boy!!!
環境
JDK版本 | JAVA version "1.8.0_212" |
---|---|
IDEA | 2020.1 |
SpringBoot | 2.3.2.RELEASE |
activiti-spring-boot-starter | 7.1.0.M5 |
搭建
pom結構如下
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.code</groupId>
<artifactId>activiti_demo</artifactId>
<version>1.0-SNAPSHOT</version>
<description>
本節主要在於學習activiti, 話不多說, 肝就完事
</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<spring.boot.version>2.3.2.RELEASE</spring.boot.version>
<activiti.version>7.1.0.M1</activiti.version>
</properties>
<dependencies>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter</artifactId>
<version>${activiti.version}</version>
</dependency>
<!--web操作-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--驅動-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!--測試-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<!--mybatis-->
<!--<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>2.1.5</version>
</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
yml配置
server:
port: 8080
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql:///activiti?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: root
password: 123456
# activiti配置
activiti:
history-level: full
db-history-used: true
database-schema-update: true
注意: 因為activiti整合了security,因此需要加上部分程式碼,這段程式碼可以在官方例子程式碼中找到
@Component
public class SecurityUtil {
private Logger logger = LoggerFactory.getLogger(SecurityUtil.class);
@Autowired
private UserDetailsService userDetailsService;
public void logInAs(final String username) {
final UserDetails user = userDetailsService.loadUserByUsername(username);
if (user == null) {
throw new IllegalStateException("User " + username + " doesn't exist, please provide a valid user");
}
logger.info("> Logged in as: " + username);
SecurityContextHolder.setContext(new SecurityContextImpl(new Authentication() {
public Collection<? extends GrantedAuthority> getAuthorities() {
return user.getAuthorities();
}
public Object getCredentials() {
return user.getPassword();
}
public Object getDetails() {
return user;
}
public Object getPrincipal() {
return user;
}
public boolean isAuthenticated() {
return true;
}
public void setAuthenticated(boolean b) throws IllegalArgumentException {
}
public String getName() {
return user.getUsername();
}
}));
org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(username);
}
}
到此基本算是搭建完成...
執行專案,會生成如下25張表
act_evt_log -- 估計是日誌一類的
act_ge_* -- 是儲存部署的資源的,下一篇我們就可以看到
act_hi_* --是歷史一類的,在yml裡面配置之後才會生成歷史相關的表
act_ru_* -- 不用說了,例項執行一類的相關記錄表
相關文章
- springboot 整合 activiti 流程引擎Spring Boot
- activiti整合springboot的一個怪問題Spring Boot
- SpringBoot整合Activiti7使用Spring Boot
- SpringBoot學習之整合SwaggerSpring BootSwagger
- SpringBoot學習之整合MybatisSpring BootMyBatis
- SpringBoot學習之整合AOPSpring Boot
- Rabbit學習---SpringBoot整合RabbitMQSpring BootMQ
- 【springboot】學習4:整合JDBC、整合druid、整合mybatis、整合 SpringSecuritySpring BootJDBCUIMyBatisGse
- Elasticsearch學習(三)springboot整合ElasticSearchElasticsearchSpring Boot
- Elasticsearch學習<四>SpringBoot整合esElasticsearchSpring Boot
- activiti學習記錄
- 整合學習(一):簡述整合學習
- 個人學習系列 - SpringBoot整合RabbitMQSpring BootMQ
- Activiti 學習(三)—— Activiti 流程啟動並完成
- activiti學習筆記二筆記
- Activiti配置整合到nacos
- activiti學習筆記(四)managementService筆記
- SpringBoot整合ElasticSearch 入門demo學習筆記Spring BootElasticsearch筆記
- jackson學習之九:springboot整合(配置檔案)Spring Boot
- jackson學習之十(終篇):springboot整合(配置類)Spring Boot
- 工作流引擎Activiti與SpringBoot2整合--開源軟體誕生17Spring Boot
- 每天學點SpringCloud(一):使用SpringBoot2.0.3整合SpringCloudGCCloudSpring Boot
- springboot activiti 整合專案框架原始碼 shiro 安全框架 druid 資料庫連線池Spring Boot框架原始碼UI資料庫
- Springcloud學習筆記68--springboot 整合Caffeine 本地快取GCCloud筆記Spring Boot快取
- SpringBoot資料訪問(一) SpringBoot整合MybatisSpring BootMyBatis
- Activiti工作流基礎學習筆記筆記
- SpringBoot 學習Spring Boot
- springboot學習Spring Boot
- SpringBoot學習日記(一)開始Spring Boot
- 一文帶你學習SpringBootSpring Boot
- 整合學習
- 【SpringBoot學習一】開發入門--快速建立springboot程式Spring Boot
- 機器學習-整合學習機器學習
- Activiti(一) activiti資料庫表說明資料庫
- activiti 工作流 springboot 後臺框架平臺 整合程式碼生成器 shiro 許可權Spring Boot框架
- SpringBoot整合RabbitMQ(一)快速入門Spring BootMQ
- 機器學習-整合學習LightGBM機器學習
- SpringBoot(19)---SpringBoot整合ApolloSpring Boot