You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
By clicking “Sign up for GitHub”, you agree to our
terms of service
and
privacy statement
. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
it seems that spring doesn't support
/*.text
resource mapping pattern.
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// this doesn't work
if (!registry.hasMappingForPattern("/*.text")) {
registry.addResourceHandler("/*.text").addResourceLocations("/static/text/");
// works like a charm
if (!registry.hasMappingForPattern("/*.js")) {
registry.addResourceHandler("/*.js").addResourceLocations("/static/js/");
/* if (!registry.hasMappingForPattern("/js*//**")) {
registry.addResourceHandler("/js*//**").addResourceLocations("/static/js/");
if (!registry.hasMappingForPattern("/img*//**")) {
registry.addResourceHandler("/img*//**").addResourceLocations("/static/img/");
Neither mapping works for me, and I'm not sure I'd expect them to. Both of these mappings do work:
registry.addResourceHandler("/*.text").addResourceLocations("classpath:/static/text/");
registry.addResourceHandler("/*.js").addResourceLocations("classpath:/static/js/");
If this doesn't solve your problem, please provide a small sample that illustrates the behaviour you've described above and we can take another look.
Under your config,the static files are put under src/main/resources/
and everything goes well.
My files are under src/main/webapp/
,then the problem comes.