AnsweredAssumed Answered

Inject/Load bean spring from activiti context

Question asked by kse on Jun 20, 2013
Latest reply on Jun 24, 2013 by jbarrez
Hi all,

Is there any way to inject and load spring beans from activiti context ?
Here is my case:  I have my own custom class implementing Tasklistener containing a property which is (should be) injected using setter by spring.

public final class AddDateMetierUserTaskListener implements TaskListener {

    public static final String DATE_METIER_VAR = "dateMetier";

    private CalculDateMetierService calculDateMetierService;

    public void notify(DelegateTask delegateTask) {
        Assert.argumentNotNull("delegateTask", delegateTask);
        UserTask userTask = new DelegateTaskAdapter(delegateTask, delegateTask.getVariables());

        LocalDate dateMetier = calculDateMetierService.dispatchCalculDateMetier(userTask);
        if (dateMetier != null) {

    public void setCalculDateMetierService(CalculDateMetierService calculDateMetierService) {
        this.calculDateMetierService = calculDateMetierService;


But what I noticed is that property calculDateMetierService is always null. What I understood from that is we have 2 separate contexts: one Spring and other Activiti. And i d'ont know how to communicate between these 2 contexts.
In Spring context, when tomcat is starting these injections are done properly. But when the notify method is launched from the listener the injected service is not injected and is null.

Many developpers had this problem but no one had a good solution to solve this issue. Can anyone give me some tips ?
Any ideas ?

Thanks a lot for your help