activiti整合springboot的一個怪問題

愛餘星痕發表於2018-04-05

最近想整合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


相關文章