stormnic 2019-06-15
一、Activiti7只生成了17张表
在配置文件中添加如下设置
activiti: database-schema-update: true history-level: full db-history-used: true
参数说明
databaseSchemaUpdate配置项可以设置流程引擎启动和关闭时数据库执行的策略。 databaseSchemaUpdate有以下四个值:
history-level对于历史数据,保存到何种粒度,Activiti提供了history-level属性对其进行配置。history-level属性有点像log4j的日志输出级别,该属性有以下四个值:
db-history-used为true表示使用历史表,如果不配置,则工程启动后可以检查数据库,只建立了17张表,历史表没有建立,则流程图及运行节点无法展示
二、Activiti数据库表结构
参考: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(); } }