AnsweredAssumed Answered

@Autowired in custom renderer - no service exists

Question asked by udoderk on Dec 10, 2012
Latest reply on Dec 21, 2012 by frederikheremans1
Hi all,

we need to allow in user task to select the condition, that will be used on condition flow / gateway.

As first step of those realisation with Activiti 5.10 i have created the custom form type/render/validation, registered that in applacationContext /ui-context xml files.
Then i would be set the value for the process variable, that was declared into bpmn xml file, programmaticaly.

I found the possible method

  void setVariable(String executionId, String variableName, Object value);

on RuntimeService. That class is registered as Spring bean as following

  <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
  <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
  <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
  <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
  <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
  <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />

Then i have the used that annotation to inject the runtimeService instance
@Autowired
RuntimeService runtimeService;

Because this method setVariable needs the executionId , i'm used that annotation for processInstance to get the execution id.
@Autowired
   ProcessInstance processInstance;
.

But if i start the business process and see the user task with needed mask, the runtimeService and processInstance are NULL!

What i do wrong???

Can i get the needed instances without sping magic?

Outcomes