Static resource mapping in Spring3

41 views Asked by At

My project is implemented in Spring3 and configuration is almost xml. Configuration of static resource mapping is like below:

<mvc:resources mapping="/a/**" location="file:/data/a/"/>

There is no problem when accessing /a/xxx.jpg but 404 Error is occurred when accessing subdirectory like /a/b/yyy.jpg. There is no problem about access authority of filesystem. How can I solve this problem? Additional configuration is needed?

(Add) Project directory is fine, but filesystem directory does not work

1

There are 1 answers

3
Alien On

Use something like below :

<mvc:resources location="/" mapping="/resources/**"/>

You can specify classpath also to location any particular folder like below.

<mvc:resources location="/, classpath:/META-INF/web-resources/" mapping="/resources/**"/>