SpringContextShutdownHook not activated when Running within IDEA
Answered
I am using @PreDestroy annotation for some reason(Spring boot).
In a linux deployment (bootJar, embedded Tomcat 9.30), everything works fine.
But the SpringContextShutdownHook is NOT activated when Running a "gradle bootRun" configuration within IDEA 2019.3.4
I cherish the illusion that it already had worked within Intellij but can't figure out what is the reason now...
Please sign in to leave a comment.
When you hit stop button for gradle run configuration, IDEA asks gradle to cancel the task, and the rest of the job should be done by gradle itself.
What behaviour do you get with command line Gradle?
I either use IDEA locally or start bootJar as service for jenkins.
I dont use this and would have to configure environment vars from the IDEA Gradle bootrun config within build.gradle, which I dont want to publish to git.
So, currently can't check this, but will try when some time is left.
Solution was to use Spring Boot Run/Debug Configuration instead of the Gradle Task Run/Debug Configuration.