#整合中的坑 1、start中默认也有一个spring-boot-autoconfigure-2.0..RELEASE.jar, 如果你还引用了activiti的activiti-spring-boot-starter-rest-api.jar包, 需要将两个包中的 SecurityAutoConfiguration.class 都排除 在启动类中 添加@SpringBootApplication(exclude = SecurityAutoConfiguration.class)即可 2、因为springboot的使用的的数据库驱动版本是com.mysql.cj.jdbc.Driver,创建activi的表会出现错误。 在配置文件的数据库连接中加入下面即可 nullCatalogMeansCurrent=true 如:url: jdbc:mysql://172.17.0.153:3306/ch_mms?useUnicode=true&characterEncoding=utf8 &zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true 3、pom引入activiti时排除MyBatis <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring-boot-starter-rest-api</artifactId> <version>6.0.0</version> <exclusions> <exclusion> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> </exclusion> </exclusions> </dependency> 4、这个类是加载activiti相关的配置环境,默认的checkProcessDefinitions是true,也就是说默认会扫描classpath:/processes/包下面的所有的.bpmn20.xml和.bpmn后缀的文件。而项目里没有processes的时候他就会报错。 如果不想把流程文件放processes目录下,只需用spring.activiti.process-definition-location-prefix来修改配置 5、新建一个配置类,配置不需要登录验证,否则会出现登录页 @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .anyRequest().permitAll().and().logout().permitAll(); } } 6、如果访问接口还是403,那应该就是 spring security 依赖没有排除完,排除security <exclusion> <artifactId>spring-security-config</artifactId> <groupId>org.springframework.security</groupId> </exclusion> <exclusion> <artifactId>spring-security-crypto</artifactId> <groupId>org.springframework.security</groupId> </exclusion> <exclusion> <artifactId>spring-security-web</artifactId> <groupId>org.springframework.security</groupId> </exclusion> <exclusion> <artifactId>spring-security-core</artifactId> <groupId>org.springframework.security</groupId> </exclusion> 7、创建用户属性视图,注意 `root`@`localhost` 要一一对应,否则没有权限 -- ---------------------------- -- View structure for act_id_group -- ---------------------------- DROP VIEW IF EXISTS `ACT_ID_GROUP`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ACT_ID_GROUP` AS select `r`.`role_key` AS `ID_`,NULL AS `REV_`,`r`.`role_name` AS `NAME_`,'assignment' AS `TYPE_` from `sys_role` `r` ; -- ---------------------------- -- View structure for act_id_membership -- ---------------------------- DROP VIEW IF EXISTS `ACT_ID_MEMBERSHIP`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ACT_ID_MEMBERSHIP` AS select (select `u`.`login_name` from `sys_user` `u` where (`u`.`user_id` = `ur`.`user_id`)) AS `USER_ID_`,(select `r`.`role_key` from `sys_role` `r` where (`r`.`role_id` = `ur`.`role_id`)) AS `GROUP_ID_` from `sys_user_role` `ur` ; -- ---------------------------- -- View structure for act_id_user -- ---------------------------- DROP VIEW IF EXISTS `ACT_ID_USER`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `ACT_ID_USER` AS select `u`.`login_name` AS `ID_`,0 AS `REV_`,`u`.`user_name` AS `FIRST_`,'' AS `LAST_`,`u`.`email` AS `EMAIL_`,`u`.`password` AS `PWD_`,'' AS `PICTURE_ID_` from `sys_user` `u` ;