1.引入依赖
<dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring-boot-starter-basic</artifactId> <version>6.0.0</version> </dependency>
2.在mybatis中去掉persistence-api
<dependency> <groupId>tk.mybatis</groupId> <artifactId>mapper-spring-boot-starter</artifactId> <version>2.1.5</version> <exclusions> <exclusion> <artifactId>persistence-api</artifactId> <groupId>javax.persistence</groupId> </exclusion> </exclusions> </dependency>
3.添加jpa
<dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring-boot-starter-jpa</artifactId> <version>6.0.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency>
4.单独引入persistence-api
<dependency> <groupId>javax.persistence</groupId> <artifactId>persistence-api</artifactId> <version>1.0</version> </dependency>
5.启动类去掉org.activiti.spring.boot.SecurityAutoConfiguration
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class}})
设置完成后启动即可,可以避免大部分异常