I am running a Spring Boot application using bootRun
task in Intellij (13.1.5 on Linux), and I am trying to shut down a listener thread in the lifecycle callback, however when stopping the app in IntelliJ, I find my listener thread is still running and logging.
- In Console:
"Disconnected from the target VM, address: ..., transport: 'socket' 6:39:22 AM: External task execution finished 'bootRun'."
- Then I did ps grep and kill the process,
only then console prints:
"2016-03-28 06:39:59.606 INFO 7740 --- [ Thread-1] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@657617e6: ...2016-03-28 06:39:59.611 INFO 7740 --- [ Thread-1] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown"
My Questions:
- Why stopping app in Intellij not closing application context?
- Accodring to Doc, Spring Web app automatically registers shutdown hooks. But I have tried
@PreDestroy
,destroyMethod
, and implementsLifeCycle
, why does none of them get called?