Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is spring devtools not working when I change my static files and reload the page?

I am using a dependency as:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
    <scope>runtime</scope>
</dependency>

The devtools work fine when I make changes to my .java files but doesn't work when I make changes in my static files(.html files). Also, the change is not seen when I reload the page. I have to restart the application to see the changes. And it is quite a time consuming to restart the app every time I make a few small changes.

like image 492
pujan kc Avatar asked Nov 04 '25 22:11

pujan kc


1 Answers

In spring-boot-maven-plugin in pom.xml add the following configuration:

<configuration>
    <addResources>true</addResources>
</configuration>

The above will work if you starting the app from the command line. However, please see this post for more details on this: Refreshing static content with Spring MVC and Boot

like image 135
fiveelements Avatar answered Nov 06 '25 13:11

fiveelements



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!