How do you DispatcherServlet interception .do this URL, there is no problem of access than static resources. If your DispatcherServlet block "/", to intercept all requests, while .js, *. Jpg access will be blocked.
Option One:
The following code written in the web.xml file, must be written in front of DispatcherServlet, so defaultServlet first interception, this will not enter the Spring. To configure multiple, each a configuration file.
1 <servlet-mapping>
2 <servlet-name>default</servlet-name>
3 <url-pattern>*.jpg</url-pattern>
4 </servlet-mapping>
5 <servlet-mapping>
6 <servlet-name>default</servlet-name>
7 <url-pattern>*.js</url-pattern>
8 </servlet-mapping>
9 <servlet-mapping>
10 <servlet-name>default</servlet-name>
11 <url-pattern>*.css</url-pattern>
12 </servlet-mapping>
The second:
the bean file write the following code
<mvc:annotation-driven/>
<mvc:default-servlet-handler/>
Third:
In the bean file write the following code
<mvc:annotation-driven/>
<mvc:resources mapping="/images/**" location="/images/" />
Choose one like
in interject: / * indicates spring will intercept all .jsp resources.
Reference from: https: //www.cnblogs.com/caoyc/p/5639078.html