我无法让mvc:resources
工作,它会返回HTTP 404错误。我的applicationContext.xml的相关部分:
<mvc:resources mapping="/resources/**" location="file:///C:/Users/ASUS/Desktop/app_images/" />
我在文件夹C:/ Users / ASUS / Desktop / app_images中有一个名为“user_dfd3f052138649fe8e76fb46e62e2417.jpeg”的.jpeg文件。如果我转到地址http://localhost:8084/Pro/resources/user_dfd3f052138649fe8e76fb46e62e2417.jpeg我收到了http 404错误,但我可以使用url文件获取此图像:/// C:/Users/ASUS/Desktop/app_images/user_dfd3f052138649fe8e76fb46e62e2417.jpeg
部署描述符文件的潜在相关部分:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<context-param>
<param-name>imagesFolderRoot</param-name>
<!--<param-value>/home/asus/app_images/pro</param-value>-->
<param-value>C:\Users\ASUS\Desktop\app_images</param-value>
</context-param>
<context-param>
<param-name>allowedUploadImageExtensions</param-name>
<param-value>image/jpg,image/png,image/jpeg</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>