I see many Java EE related question that says "never use Thread and Timer API in JavaEE/Servlet Based environments". Example
Is the same true for Spring web applications?
I saw examples where org.springframework.core.task.TaskExecutor, CompletableFuture, and @Async were used in Spring application, and I haven't seen use cases of Thread API.
I guess that the issue with Thread API is related to some request parameters that cannot be accessed by the spawned thread. I also heard "context is not propagated to the new thread".
I also saw "JSR-236" which says "java.util.Timer, java.lang.Thread and the thread pool creation APIs from the Java SE concurrency utilities (JSR-166) in the java.util.concurrent package should never be used within managed environments, as it creates threads outside the purview of the container".
May you clarify this question? Which parameter may be lost if we create new Thread in Spring web application? Are there use cases when it is safe to use Thread API in Spring Web App? How Spring's TaskExecutor, @Async handle this issue?
Thanks.