No ApplicationContext when integrating camunda-spring-boot-starter

Hi,

I am trying to migrate an existing Spring Boot application to the camunda spring boot starter with the typically annotation-oriented way: @Service, @Autowire, @Bean, … . When I add the dependency and start the application, it fails when Spring is trying to initialize the first @Controller and injects the first dependency.

Currently, I am not able to reproduce the problem in a sandbox application.

I have tried to add @EnableProcessApplication, @ProcessApplication and manually define @ComponentScan (Our beans are all in subpackage, so it is normally not necessary) to our @SpringBootApplication class, but nothing works.

Can anybody give me a tip what might fail here?

BR,
Michael

Edit: Extension below hasn’t solved the problem. It has just put another problem in between. By solving the cyclic dependency injection, I have still the same problem.

I have added “extends SpringBootProcessApplication” to our main application and at least this problem is solved.

Sadly, I have no a circular dependeny cycle:
┌─────┐
| org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
↑ ↓
| wjtDomainApplication (field protected org.camunda.bpm.engine.ProcessEngine org.camunda.bpm.spring.boot.starter.SpringBootProcessApplication.processEngine)
↑ ↓
| org.camunda.bpm.spring.boot.starter.CamundaBpmAutoConfiguration$ProcessEngineConfigurationImplDependingConfiguration (field protected org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl org.camunda.bpm.spring.boot.starter.CamundaBpmAutoConfiguration$ProcessEngineConfigurationImplDependingConfiguration.processEngineConfigurationImpl)
↑ ↓
| processEngineConfigurationImpl defined in class path resource [org/camunda/bpm/spring/boot/starter/CamundaBpmConfiguration.class]
↑ ↓
| camundaDatasourceConfiguration (field protected org.springframework.transaction.PlatformTransactionManager org.camunda.bpm.spring.boot.starter.configuration.impl.DefaultDatasourceConfiguration.transactionManager)
└─────┘

However, that is another problem…

Hi @miwoe,
can you give some more information? At least exception stacktrace could help.

Hi @sdorokhova

I have added the stacktrace below. But it just says that it cannot find a required bean. There is no error before. It seems that all @Service annotated classes are either not initialized by Spring or in a different application context after adding camunda-spring-boot-starter.

Does the csb-starter change the “component scan” configuration? Just strange that it finds the Controller but not the service which is in a sibling package.

The stacktrace:


APPLICATION FAILED TO START


Description:

Field historyService in de.vignold.bs.wjt.domain.controller.HistoryController required a bean of type ‘de.vignold.bs.wjt.domain.service.history.HistoryService’ that could not be found.

Action:

Consider defining a bean of type ‘de.vignold.bs.wjt.domain.service.history.HistoryService’ in your configuration.

We sorted that out: Using Spring, it is a bad idea to have two beans with same name, in this case HistoryService, one provided by Camunda, the other one provided by the domain app…

Spring creates the Camunda HistoryService bean first and then does not create the domain’s one, because a bean with this name is already registered.

2 Likes