标签:org 获取 package conf 两种 xtend classpath and nbsp
#url访问的请求路径
spring.mvc.static-path-pattern=/uploadWheel/**
#图片存放的真实路径
#另外,如果是服务器路径,则是file:/data/pic ,注意不是双斜杠!
spring.resources.static-locations=file:D:/uploadWheel/
访问路径是:
localhost:8888/ 图片名
package com.taotao.Config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** * @Description:访问项目外资源路径 * @Author: TaoTao * @Date:2019/11/16 11:16 */ @Configuration public class WebMvcConfiguration extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { //addResourceHandler是指你想在url请求的路径 //addResourceLocations是图片存放的真实路径 registry.addResourceHandler("/**").addResourceLocations("file:D:/uploadWheel/").addResourceLocations("classpath:/static/"); super.addResourceHandlers(registry); } }
标签:org 获取 package conf 两种 xtend classpath and nbsp
原文地址:https://www.cnblogs.com/book-mountain/p/11871011.html