title: How to access Spring Beans in Activiti JavaDelegate tasks
body: <p>I am using activiti 5.16.1 to enable workflow in my project.</p>
  
  <p>I have a spring beans which carry out business task such as populating data from database for a given id.</p>
  
  <p>When I try to use these beans in JavaDelegate task, these beans are not populated.</p>
  
  <pre><code>@Component
  public class ServiceClassDelegateSample implements JavaDelegate {
  
      @Autowired
      private SampleService sampleService;
  
      @Override
      public void execute(DelegateExecution delegateExecution) throws Exception {
  
          sampleService.doSomeTask();
      }
  
  }
  </code></pre>
  
  <p>However sampleService is always set to null.</p>
  
  <p>Are you aware of how to use spring beans in JavaDelegate task?</p>
  
  <p>There is similar question <a href="https://stackoverflow.com/questions/6474324/how-can-i-access-a-spring-bean-in-activiti-javadelegate">here</a> without any proper solution and I hope there is better way in newer version of Activiti.</p>