This is a much-required process while we develop spring boot applications. We do changes continuously and want to see the result at the same time without manually rebuilding the application.
For the changes in Java files, we need to include a dependency
developmentOnly 'org.springframework.boot:spring-boot-devtools'
In Eclipse, this should be enough, I have not tested it though.
If you are using IntelliJ, we need to do one extra step to enable hot-reload.
{
"name": "Corona Tracker",
"scripts": {
"gulp-watch": "gulp-watch"
},
"dependencies": {
"gulp": "^4.0.2",
"gulp-watch": "^5.0.1"
}
}
var gulp =require('gulp'),
watch=require('gulp-watch');
gulp.task('watch',function(){
return watch('src/main/resources/templates/**/*.*',()=>{
gulp.src('src/main/resources/templates/**')
.pipe(gulp.dest('build/resources/main/templates/'));
});
});
The task defined here is "watch"
6) Run "gulp watch" which watches directory templates, and if any changes are there, it copies the changes into the build directory.
I preferred this method of loading static file changes because it is fast and fully customizable. The method in IntelliJ did not work in my case. (Changing IntelliJ registry did not sound good to me)