Activiti7相关问题汇总
一、Activiti7只生成了17张表
在配置文件中添加如下设置
activiti: database-schema-update: true history-level: full db-history-used: true
参数说明
databaseSchemaUpdate配置项可以设置流程引擎启动和关闭时数据库执行的策略。 databaseSchemaUpdate有以下四个值:
- false:false为默认值,设置为该值后,Activiti在启动时,会对比数据库表中保存的版本,如果没有表或者版本不匹配时,将在启动时抛出异常。
- true:设置为该值后,Activiti会对数据库中所有的表进行更新,如果表不存在,则Activiti会自动创建。
- create-drop:Activiti启动时,会执行数据库表的创建操作,在Activiti关闭时,执行数据库表的删除操作。
- drop-create:Activiti启动时,执行数据库表的删除操作在Activiti关闭时,会执行数据库表的创建操作。
history-level对于历史数据,保存到何种粒度,Activiti提供了history-level属性对其进行配置。history-level属性有点像log4j的日志输出级别,该属性有以下四个值:
- none:不保存任何的历史数据,因此,在流程执行过程中,这是最高效的。
- activity:级别高于none,保存流程实例与流程行为,其他数据不保存。
- audit:除activity级别会保存的数据外,还会保存全部的流程任务及其属性。audit为history的默认值。
- full:保存历史数据的最高级别,除了会保存audit级别的数据外,还会保存其他全部流程相关的细节数据,包括一些流程参数等。
db-history-used为true表示使用历史表,如果不配置,则工程启动后可以检查数据库,只建立了17张表,历史表没有建立,则流程图及运行节点无法展示
二、Activiti数据库表结构
- act_evt_log 表示EVENT,目前只有一张表ACT_EVT_LOG,存储事件处理日志,方便管理员跟踪处理。通用数据表
- act_procdef_info 流程定义信息
参考:https://blog.csdn.net/hj7jay/article/details/51302829
三、取消Activiti api security 验证
取消如下:
用户名是user 密码在启动控制台中
在启动类名上添加
@SpringBootApplication(exclude ={SecurityAutoConfiguration.class, org.activiti.spring.boot.SecurityAutoConfiguration.class} )
三、取消Activiti7 集成swagger 出现401、402
在配置文件中添加:
@Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .anyRequest() .authenticated() .and() .httpBasic(); }
配置文件举例:
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.provisioning.JdbcUserDetailsManager; import javax.sql.DataSource; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @Configuration public class ApplicationConfiguration extends WebSecurityConfigurerAdapter { private Logger logger = LoggerFactory.getLogger(ApplicationConfiguration.class); @Autowired private DataSource dataSource; @Bean public UserDetailsService myUserDetailsService() { JdbcUserDetailsManager jdbcUserDetailsManager = new JdbcUserDetailsManager(dataSource); String[][] usersGroupsAndRoles = { {"salaboy", "password", "ROLE_ACTIVITI_USER", "GROUP_activitiTeam"}, {"ryandawsonuk", "password", "ROLE_ACTIVITI_USER", "GROUP_activitiTeam"}, {"erdemedeiros", "password", "ROLE_ACTIVITI_USER", "GROUP_activitiTeam"}, {"other", "password", "ROLE_ACTIVITI_USER", "GROUP_otherTeam"}, {"admin", "password", "ROLE_ACTIVITI_ADMIN"}, }; for (String[] user : usersGroupsAndRoles) { List<String> authoritiesStrings = Arrays.asList(Arrays.copyOfRange(user, 2, user.length)); logger.info("> Registering new user: " + user[0] + " with the following Authorities[" + authoritiesStrings + "]"); // jdbcUserDetailsManager.createUser(new User(user[0], passwordEncoder().encode(user[1]), // authoritiesStrings.stream().map(s -> new SimpleGrantedAuthority(s)).collect(Collectors.toList()))); } return jdbcUserDetailsManager; } @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .anyRequest() .authenticated() .and() .httpBasic(); } @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } }
相关推荐
柳木木的IT 2020-11-04
shixiaoguo0 2020-05-06
heywakeup 2020-04-23
随心而作 2020-01-08
lightlanguage 2019-12-04
RickyIT 2019-11-17
fayeyiwang 2019-11-06
ganjing 2019-10-07
huoyunp 2019-09-25
ganjing 2019-09-18
Cshnuscw 2019-09-03
白净垃圾桶 2019-08-30
zzhao 2019-08-29
yxlnum 2019-08-21
ACcoding 2014-05-12
嵌入式企鹅圈 2012-11-12
luohnoyo 2011-12-17
whileinsist 2011-12-17