I have a singleton Spring bean that creates a couple of tasks ( java.util.concurrent.Callable 's) at runtime for parallel work. Right now, Callable defined as inner classes in a singleton bean, and singleton beans create them simply by creating them using new Task(in) , where in is a parameter known only at runtime.
Now I want to extract the inner class Task to a regular top-level class, because I want to make the Task call() method transactional, so I need it to be a Spring bean.
I think I need to give my singleton some kind of factory from Task s, but the tasks should be a prototype of Spring beans that take a run-time value as a constructor parameter. How can i do this?
Jan van den bosch
source share