title: Passing arguments to runnable class in Spring's Taskexecutor
body: <p>I have a trouble understanding how to connect all the parts with Taskexecutor.
  I have a task I created, BidProposalTask. (a class which implements Runnable)
  the task constuctor has one argument, and needs Autowiring for DB access, etc.</p>
  
  <p>I came up with this code for the executor class:</p>
  
  <pre><code>public class ExecuteBidProposalTask {
  
      private TaskExecutor taskExecutor;
      private BidProposalTask bidProposalTask;
  
      public ExecuteBidProposalTask(TaskExecutor taskExecutor,
          BidProposalTask bidProposalTask) {
      super();
      this.taskExecutor = taskExecutor;
      this.bidProposalTask = bidProposalTask;
      }
  
      public void start() {
      taskExecutor.execute(bidProposalTask);
      }
  
  }
  </code></pre>
  
  <p>and the following XML context configuration:</p>
  
  <pre><code>&lt;bean id="taskExecutor"
      class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"&gt;
      &lt;property name="corePoolSize" value="5" /&gt;
      &lt;property name="maxPoolSize" value="10" /&gt;
      &lt;property name="queueCapacity" value="25" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>as I saw in Spring's documentation, I created a TaskExecutor bean, however, the problem is that the BidProposalTask also needs to be injected. it isn't a singleton, I need to create it over and over in the project with different argument for the constructor.</p>
  
  <p>basically the question is how to autowire a non-singleton bean, so it's autowiring will also work ?</p>
  
  <p>This is quite complicated to explain, so I hope you understand my question...</p>