I am starting my camunda application from different spring boot project as shown below. The process instance is started, but the beans are not initialized(i.e @Autowiring in BeanInjection delegate is null)
RestController call from different spring boot project:
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
log.debug("checkpoint2: "+processEngine.getName());
if (processEngine != null) {
ProcessInstanceWithVariables instance = processEngine.getRuntimeService().createProcessInstanceByKey("version7")
.setVariable("inHeader", header)
// TODO change to inWorkOrder
.setVariable("sampleObject", sample)
.executeWithVariablesInReturn();
And this is my java delegate which is a spring component having @Autowired field, which is not getting populated and is null
package com.wom_camunda_process;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
@Component
public class BeanInjection implements JavaDelegate {
@Autowired
BeanAutoWire beanAutoWire;
@Override
public void execute(DelegateExecution execution) throws Exception {
// TODO Auto-generated method stub
System.out.println("ENTER... BeanInjection");
beanAutoWire.printStatement();
}
}