Reputation: 674
During development phase, Spring boot cached the static JS and CSS files, and the changes in them were not reflected even after server restart. Initially I thought Chrome was caching the files but the problem persisted even after i changed browsers, which led me to the conclusion that it was my application which was sending the cached pages.
To disable the cache, I tried to add this key-value pair to the application.properties file as suggested on some SO answers:
spring.cache.type=NONE
But even this didn't solve my caching problem. I haven't used any caching related annotations either. Any help is greatly appreciated. I am currently running the project by renaming the file every time I make some changes which is a really long and tiresome process.
The POM dependencies are: spring-boot-starter-web
which was default when i created project using Spring Initializr, and tomcat-embed-jasper
for compiling JSP. The plugin used is: spring-boot-maven-plugin
.
Upvotes: 1
Views: 2547
Reputation: 77226
spring.cache
properties are used to control the general-purpose @Cacheable
mechanism using a provider such Caffeine. You're looking for the configuration for the Web-specific caching system, spring.resources.chain
:
spring.resources.chain.cache: false
Upvotes: 0
Reputation: 8355
Use Spring boot dev tools, it provides many features including the LiveReload which enables you to hot swap the changes. once dev tools are enabled any changes to static files as well as some changes to java source can be applied without restarting the web server.
Upvotes: 1