Recently in my project I had a need to perform some tasks asynchronously. Since we are running a webapp with Spring inside a Tomcat, the ThreadPoolTaskExecutor provided by Spring was a solution.
However the architect raised some objections, stating that it is horrible/forbidden/absolute evil to spawn thread/have a thread pool in a webapp.
By searching a little bit on the net and on StackOverflow, I realized that yes, it is a bad practice to have your own thread pool inside a Java EE container. The rationale was that if you have your own thread pool, the container is not aware of it and cannot manage resources properly. It is especially critical when you need to do some hot deployments of your webapp.
Now, our use case is a Spring webapp run inside Tomcat. First, can we consider the Spring container like a light Java EE container ? In this case it is Spring which manages directly the threadpool lifecycle and not the application itself, isn't it ?
Second, does the hot deployment argument also apply for this configuration ?
And yes, I know that it is possible to declare a worker pool directly in Tomcat and inject it through JNDI into Spring. But it's a little bit hassle compared to the direct ThreadPoolTaskExecutor facility provided by Spring
So my final question is: is the objection of the architect relevant in my case ?
Thanks for your suggestions and thoughts on this topic.