I have been working on spring framework controller / service / repository annotations and each class is a singleton. Whenever a request comes to server , server has to spawn a new thread for the corresponding controller class ( is a singleton ) so that each thread will have its own stack to execute the same method of class in different stacks.
When i see controller class it neither implement Runnable class nor extending thread.
I would like to know the code behind this. How exactly a server spawns a thread for singleton controller class.
Will it be done by reflection or Anonymous Thread or any other method. Please post example code.