springboot:映射静态资源路径_spring

 

#映射静态资源路径
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:F:/myCode/springBootCode/IdeaProjects/architect/


#显示mybatis的sql
logging.level.com.atchina.springbootmvcproject.mapper = debug

 

在application.properties文件中,使用 spring.resources.static-locations 映射静态资源路径

springboot:映射静态资源路径_spring_02

suolong.jpg是在本地磁盘上存储的,没有再项目中存储,映射了静态资源路径后,我们就可以通过url访问该资源。

springboot:映射静态资源路径_ide_03

 

 

 

 

而lufei.jpg是在项目中存储的,同样的spring.resources.static-locations中也映射了classpath:/static/,所以我们也可以通过url访问该资源。

springboot:映射静态资源路径_properties文件_04

springboot:映射静态资源路径_静态资源_05