title: how to get multiple instances of same bean in spring?
body: <p>By default, spring beans are singletons. I am wondering if there is a way to get multiple instances of same bean for processing.</p>
  
  <p>Here is what I do currently</p>
  
  <pre><code>    @Configuration
      public class ApplicationMain { 
  
       @Value("${service.num: not configured}")
      private int num;
  
      //more code
  
  @PostConstruct
  public void run(){
  
          for (int i = 0; i &lt; num ; i++) {
                      MyService ser = new MyService(i);
                      Future&lt;?&gt; tasks = executor.submit(ser);
                  }
  
      }
  }
  </code></pre>
  
  <p>Here is the Service class</p>
  
  <pre><code>    public class MyService implements Runnable {
  
      private String name;
  
      public Myservice(int i){
  
      name=String.ValueOf(i);
  
      }
    }
  </code></pre>
  
  <p>I have simplified my usecase here.
  I want to have MyService as spring bean and get as many as possible based on configuartion (which is <code>num</code>) in the above for-loop? wondering how that is possible.</p>
  
  <p>Thanks</p>