Refreshing static content with Spring MVC and Boot

前端 未结 15 1968
迷失自我
迷失自我 2020-11-28 07:02

I\'m evaluating Spring MVC & Boot and AngularJs for building web applications. I\'ve run into the problem that when I make modifications to my static content (html, js,

相关标签:
15条回答
  • 2020-11-28 07:45

    @eigil metioned addResources config for maven build. I'm using spring-boot-gradle-plugin in a gradle build, and I found this Spring Boot github issue , and the Spring Boot doc mentioned this option too. Just add this directive to build.gradle and run Gradle task bootRun, then resource file refreshes immediately when saved. FYI.

    0 讨论(0)
  • 2020-11-28 07:45

    What I ended up using was Browsersync with grunt. browsersync and grunt watches your static resources on disk and updates the browser when you edit the files. It acts as a kind of proxy. This way you can see changes in UI immediately without building or restarting anything.

    Grunt, browsersync, spring boot and angularjs are configured for you if you use JHipster which I used to setup my project.

    Granted this requires a lot more tools than just an IDE and is a lot more complicated so I wouldn't recommend this for every project.

    0 讨论(0)
  • 2020-11-28 07:45

    spring-boot-devtools is not the solution to "hot deploy" of edited static htm/js

    I configured a web facet inside intellij so that when I use it to edit html/js file inside resources/static, intellij then knows to copy the updated file to ./target and the spring boot application I have launched inside the automatically displays that content

    see https://www.jetbrains.com/help/idea/2016.2/configuring-static-content-resources.html

    0 讨论(0)
提交回复
热议问题