Hi,
We're building a ThreadFactory
so everytime a singleton controller needs a new thread, i get a new instance everytime.
Looking at Lookup method injection looks good but what if we have multiple thread classes? I like the fact that i can autowire my threadBeans.
like:
public abstract class ThreadManager {
public abstract Thread createThreadA();
public abstract Thread createThreadB();
}
and config:
<bean id="threadManager" class="bla.ThreadManager" singleton="true">
<lookup-method name="createThreadA" bean="threadA" />
<lookup-method name="createThreadB" bean="threadB"/>
</bean>
<!-- Yes! i can autowire now :)-->
<bean id="threadA" class="bla.ThreadA" singleton="false" autowire="byType">
<bean id="threadB" class="bla.ThreadB" singleton="false" autowire="byType">
and usage:
threadManager.createThreadA();
Question: I don't want to create an abstract "create" method for every new threadclass.
Is it possible to make this generich like:
threadManager.createThread(ThreadA.class);
I also looked at ServiceLocatorFactoryBean
but for multiple classes i have to pass the bean name (not type safe).
Thank you