Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autowiring Thread class in spring

Is it possible to autowire a Thread class in spring like controller, Service? If yes what annotation shall I use to autowire such a class?

like image 833
hanumant Avatar asked Mar 01 '11 07:03

hanumant


1 Answers

Depending on what you are doing, I would consider using TaskExecutors instead of directly creating threads. This way thread lifecycle, pooling etc. is managed through the TaskExecutor.

See http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/scheduling.html

like image 187
krock Avatar answered Sep 24 '22 13:09

krock