IntelliJ does not terminate Spring Boot applications build with gradle IntelliJ does not terminate Spring Boot applications build with gradle spring spring

IntelliJ does not terminate Spring Boot applications build with gradle


I am pretty sure it's an IntelliJ issue because:

When you run the bootRun from IntelliJ's Gradle integration and then press stop, the application continues to run as you mentioned.

However, if you use the command line and run gradle bootRun and then use Cntrl+C, the application stops just fine.

Note that my setup is Windows 7, IntelliJ 13.1.3, Gradle 1.12 and Spring Boot 1.1.0.M2.

If your need to is to be able to easily debug your application, all you need to do is run the Java (or Groovy) Class that has the main method, since that it is the easiest way to run Spring Boot applications! Kudos to Spring Boot for that!!!

Of course you can continue to use Gradle for tasks like running all the tests or creating the packaged application.


I know this answer was already answered, but as this is first topic when searching in Google, I thought in sharing an alternative I went with and didn't find in other topics I read.

My main problem with this terminate was that always I changed something in my classes, I needed to restart the server, and it would fail so I needed to stop/start the server sometimes.

To avoid this, I use spring-boot-devtools. Basically:

Applications that use spring-boot-devtools will automatically restart whenever files on the classpath change.

The only catch is that on Intellij it only makes the project if click Build > Make Project, so either set it to build automatically or remember to click on make.

To use, simply add the dependency to your build.gradle / pom.xml:compile('org.springframework.boot:spring-boot-devtools')

I found this to be really useful in development.


I am using IntelliJ in Mac, running Spring boot application was giving the same issue. Whenever I run the app in Terminal and use CTRL + Z, the terminal will strop running the app. But when I run the app again in the same terminal, will give error saying the port 8080 was in use.I just tried the option to close the Terminal session ( right click -> select -> Close Session). This will close the terminal, and when I clicked the terminal option again and ran the app, it ran smoothly.