Hot reload in Spring Boot Application #1856
-
Hello, I have an Spring Boot 3 application package in war. We have maven and are using the liberty-maven-plugin. The pom looks like this
Every times we are modifying the code, we need to restart the server in order to take changes into account. Is it possible to have hot reload? Also the restart takes around 10 sec. Is it possible to tweak this to have a shorter restart time in developement mode? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I'm not sure why you need to restart the server after making app changes. Generally speaking, since you're using a WAR package, it should be possible to use the Liberty Maven Plugin "dev mode" to achieve "hot reload" like any WAR. You do need to use the This is explained in my article Running a Spring Boot 3.x application WAR file on Liberty, which is a bit over-simplified to show the different options using a Spring Boot WAR in Liberty. The article explains too that you can also, alternatively, use the Does that help? |
Beta Was this translation helpful? Give feedback.
-
I do not know why my hot reload does not work. I did initialize the project with https://start.spring.io/ initially. I attached the projects here. It has no sensible information in it. |
Beta Was this translation helpful? Give feedback.
-
@julienroy50 Great news. Can I close this discussion then? |
Beta Was this translation helpful? Give feedback.
I'm not sure why you need to restart the server after making app changes.
Generally speaking, since you're using a WAR package, it should be possible to use the Liberty Maven Plugin "dev mode" to achieve "hot reload" like any WAR. You do need to use the
SpringBootServletInitializer
to bootstrap the Spring objects from within the web container.This is explained in my article Running a Spring Boot 3.x application WAR file on Liberty, which is a bit over-simplified to show the different options using a Spring Boot WAR in Liberty.
The article explains too that you can also, alternatively, use the
<springBootApplication>
optimized deployment for a Spring Boot WAR, which allows you to use thin…