I have a spring boot application and below is the code for registrations of resource handlers:
@Configuration
public class MyAppConfig extends WebMvcConfigurerAdapter {
...
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/js/**")
.addResourceLocations("/resources/js/").setCachePeriod(31536000);
//in same directory where all the js files placed,
//I want to cache all the files in that directory
//except for one file i.e. prop.js
/*registry.addResourceHandler("/resources/js/prop.js")
.addResourceLocations("/resources/js/").setCachePeriod(0);*/
}
...
}
There are certain things I need to understand, viz.
1. What does the parameter of addResourceHandler
mean?
2. What does the parameter of addResourceLocations
mean?
3. Is there any way to explicitly prevent prop.js
from being cached?
There are may files at the same level where prop.js
is, I want all other files to be cached.