how to get multiple instances of same bean in spring?
问题 By default, spring beans are singletons. I am wondering if there is a way to get multiple instances of same bean for processing. Here is what I do currently @Configuration public class ApplicationMain { @Value("${service.num: not configured}") private int num; //more code @PostConstruct public void run(){ for (int i = 0; i < num ; i++) { MyService ser = new MyService(i); Future<?> tasks = executor.submit(ser); } } } Here is the Service class public class MyService implements Runnable {