cancel
Showing results for 
Search instead for 
Did you mean: 

Spring autowired failing inside execute method

akashraveendran
Champ in-the-making
Champ in-the-making
Hi,

I have class called CallUpdateContact which implements JavaDelegate and I use the execute function inside this class from a service task in my bpmn.
Inside the CallUpdateContact class, I have an autowired a service class but when I try to use this autowired service class object I get a null pointer exception corresponding to the autowired service class. I tried to many ways to solve (namely removing autowired annotation and giving reference bean in xml, trying to get the object using the application context etc.) but none of them worked and my problem still persists. In the bpmn file initially i has used activiti:class="<class-path>". Then I even tried changing it to activiti:delegateExpression="${callUpdateContact}" but still the problem persists. Can anyone help me out in this. I get a feeling it this issue has something to do with the way spring beans are to called in activiti.
2 REPLIES 2

warper
Star Contributor
Star Contributor
Try to add this line to your class constructor:
        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);

akashraveendran
Champ in-the-making
Champ in-the-making
Hi Warper,

Thank you. It solved my autowired issue. Sorry for the late reply.