SpringBoot项目中的虚拟路径设置

一、在application.propertier文件中添加以下代码

web.upload-path=D:/familyeduFile/
spring.mvc.static-path-pattern=/**
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${web.upload-path}

结语:通过以上的代码就可以像操作classpath:/static/路径一样操作D:/familyeduFile/。可以理解为D:/familyeduFile/就等同于springboot项目的static目录,只是在springboot项目中没有显示出来,因为它是虚拟的。

参考至:【csdn】Springboot 之 静态资源路径配置

你可能感兴趣的:(Java,SpringBoot)