to launch my Spring Boot application in production environment my company has a system that executes "java -jar" and I'm trying to simultate it in my Intellij idea and jar starts correctly and I can debug with proyect source too.
In run and debug mode, when I click in stop button the jar is stopped suddenly with the message:
Disconnected from the target VM, address: '127.0.0.1:58575', transport: 'socket'
Process finished with exit code -1
And I can´t catch the close event to close my DB connections. I've tryed other stackoverflow solutions like PortalServiceLifeCycle, @PreDestroy and setRegisterShutdownHook(false) in SpringApplication run in main.
Jar is created by Maven with clean and package goals and we haven't xml spring configurations, only annotations.
What I need to catch shutdown service to close connections?
Edit: Add my Intellij buttons:
Thank you.