Search code examples
intellij-ideaspring-boothotswap

Spring Boot hotswap with IntelliJ IDE


I have a Spring Boot application running fine with IntelliJ IDE. i.e I started the Application class that has the main method which delegates to SpringApplication.run. Everything works great except hotswap. When I change the source, I am forced to restart the application. Even if I start the application in debug mode, I don't see hotswap working. I could see that IntelliJ's Debug settings have hotswap enabled.

My observation shows that when I run the Spring Boot application, classpath used is my

/projects/MyProject/classes/production/....

Files under classes/production are not getting updated when I change the code. IntelliJ IDE compiles the files but does not update classes/production directory. How do I get hotswap working with IntelliJ IDE for Spring Boot?


Solution

  • Found out the root cause. This has nothing to do with Spring-boot. On changing my groovy source files, files were not auto-compiled.

    To recompile changed files and swap them:

    • Ctrl+Shift+F9 on Windows
    • Cmd+Shift+F9 on Mac