Does Spring's Controller
have any sort of destroy/cleanup method? I couldn't find anything in the JavaDocs for Controller
and AbstractController
. I'm looking for the equivalent of javax.servlet.Servlet
's destroy()
method.
The reason for this is that I'm starting a thread in my Spring controller. I want the thread to terminate whenever the controller is taken out of server (such as when the container is shutdown).
From stackoverflow
-
Just use the regular spring lifecycle methods. Because all Spring Controllers are Spring beans they will follow the regular lifecycle.
-
I don't think that starting a thread in a controller is a good idea. That's not what they're for, IMO.
0 comments:
Post a Comment