最近想集成activti到spring boot中,上网找了一下例子,发现很简单,就开干了!
- 建立maven工程后,加入acitivti的引入
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-basic</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
启动spring boot应用,发现有问题了,报错如下
Caused by: java.io.FileNotFoundException: class path resource [processes/] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:187) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:464) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:293) ~[spring-core-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1293) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.context.support.GenericApplicationContext.getResources(GenericApplicationContext.java:233) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.activiti.spring.boot.AbstractProcessEngineConfiguration.discoverProcessDefinitionResources(AbstractProcessEngineConfiguration.java:79) ~[activiti-spring-boot-starter-basic-6.0.0.jar:na]
at org.activiti.spring.boot.AbstractProcessEngineAutoConfiguration.baseSpringProcessEngineConfiguration(AbstractProcessEngineAutoConfiguration.java:74) ~[activiti-spring-boot-starter-basic-6.0.0.jar:na]
at org.activiti.spring.boot.DataSourceProcessEngineAutoConfiguration$DataSourceProcessEngineConfiguration.springProcessEngineConfiguration(DataSourceProcessEngineAutoConfiguration.java:57) ~[activiti-spring-boot-starter-basic-6.0.0.jar:na]
at org.activiti.spring.boot.DataSourceProcessEngineAutoConfiguration$DataSourceProcessEngineConfiguration$$EnhancerBySpringCGLIB$$4f170b93.CGLIB$springProcessEngineConfiguration$1(<generated>) ~[activiti-spring-boot-starter-basic-6.0.0.jar:na]
at org.activiti.spring.boot.DataSourceProcessEngineAutoConfiguration$DataSourceProcessEngineConfiguration$$EnhancerBySpringCGLIB$$4f170b93$$FastClassBySpringCGLIB$$d87b00aa.invoke(<generated>) ~[activiti-spring-boot-starter-basic-6.0.0.jar:na]
怎么回事,跑不起来?
按报错,说要在class下找processes这个目录下
手动在resources下建个目录processes,再跑跑。
结果,报错依旧!
后面尝 试在那个processes目录下,放一个流程的xml文件,发现启动成功了!
查一下后台数据库表,发现自动发布了一个流程定义
后面发现加入配置即不会自动扫描该目录了
spring:
activiti:
check-process-definitions: false