I want to test my code against concurrency issues. I have a prototype bean:
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class MyBeanRunner {}
I have my thread class:
class MyJob extends Thread {
@Autowired
private MyBeanRunner jobRunner;
@Override
public void run() {...}
}
Now I try to run it:
Future future = executorService.submit(new MyJob());
And jobRunner is null. How can I tell Spring to autowire MyBeanRunner inside MyJob?