EDIT: This is on spring 3.1.0
I've seen other questions on this subject, and tried a few things but nothing seems to work for me.
I plan to add my version number to the path of static resources, to force requests from browsers on new versions, so I started doing as instructed on this part of the spring documentation.
Before any change, the path <context>/assets/js/base/lib/jquery-1.7.2.js
works and points to an existing file.
What I did was add to my java config class the following:
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/my-assets/**")
.addResourceLocations("/assets/**");
}
The plan was to use the version number, instead of just my-assets
once I get it to work. But it didn't, even though my logs said:
17:28:56,077 INFO [SimpleUrlHandlerMapping] Mapped URL path [/my-assets/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
I then tried some variations:
.. ("/my-assets/**").addResourceLocations("/assets/");
.. ("/my-assets/js/base/lib/**").addResourceLocations("/assets/js/base/lib/");
.. ("/my-assets/js/base/lib/**").addResourceLocations("/assets/js/base/lib/**");
And even tried adding these afterwards:
registry.setOrder(Ordered.LOWEST_PRECEDENCE);
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
To no avail. In all cases <context>/assets/js/base/lib/jquery-1.7.2.js
still worked and <context>/my-assets/js/base/lib/jquery-1.7.2.js
didn't.
This is my directory structure:
├── assets
│ ├── charts
│ ├── css
│ ├── font
│ ├── images
│ └── js
├── META-INF
└── WEB-INF
├── jsp
├── layout
└── tags
Any thoughts on what could be the issue?
Thanks!