SpringBoot集成Camunda 启动失败

ERROR

***************************
APPLICATION FAILED TO START
***************************

Description:

Field processEngine in org.camunda.bpm.engine.spring.SpringProcessEngineServicesConfiguration required a bean of type 'org.camunda.bpm.engine.ProcessEngine' that could not be found.


Action:

Consider defining a bean of type 'org.camunda.bpm.engine.ProcessEngine' in your configuration.


Solution

Spring Boot 2.1以上的版本不支持Camunda 需要将版本下调到 2.0.2.RELEASE.

Reason

Camunda配置类 CamundaBpmAutoConfiguration 上面有个Import 注解,注入了一个
SpringProcessEngineServicesConfiguration类, SpringBoot集成Camunda 启动失败_第1张图片
然而SpringProcessEngineServicesConfiguration类中有个自动注入类,ProcessEngine SpringBoot集成Camunda 启动失败_第2张图片
坑爹的就是,SpringProcessEngineServicesConfiguration中需要注入的ProcessEngine的ProcessEngineFactoryBean居然是在CamundaBpmAutoConfiguration类中通过@Bean 注解注入到容器中
SpringBoot集成Camunda 启动失败_第3张图片

猜测 (没有验证)

如果2.0.2的spring boot 是先加载CamundaBpmAutoConfiguration类中的@Bean 再加载@Import 那就没事,
2.1.0以上 是先加载@import 再加载@Bean 就大条了,SpringProcessEngineServicesConfiguration中的ProcessEngine就会在ProcessEngineFactoryBean初始化之前,被调用,于是就有上面的ERROR了;

你可能感兴趣的:(Camunda,Bug)