lundi 2 mars 2015

How to start a thread inside spring container

Please help to resolve a problem. I have a thread like below the code.



public class A implements Runnable {

public void run() {
while(true) {
//Do something something important
}
}


}


I want to configure this thread in spring configuration file in such a manner, so that when spring container gets started, the thread start running. It means I have to start the thread using th.start() in a class, but that will never be used. The thread should start without instantiating any bean from the container. It is not Timer task type functionality.


Aucun commentaire:

Enregistrer un commentaire