The correct way to “close” the spring context in J2SE
•
Java
I am currently experiencing JPA transaction manager problems in J2SE applications
The latest request is not saved correctly in the database (it must be a cache problem)
This seems normal because the exit of the program does not seem to "clean" all beans in the spring application context
Do you know if there is a method to close the spring context before exiting?
Thank you first
Solution
The spring reference manual on this topic
Basically, you need to call registerShutdownHook () in the context of the application.
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码