idea下springboot 项目在static目录下添加文件不生效

idea下springboot 项目在static目录下添加文件不生效

问题描述
是这样子的,个人项目目录结构以下:
s_w_3
我在static目录下,建立了index.html和aaaa.jpg这两个文件。而后,启动服务访问 http://loclahost:8080/
能够正常访问
s_w_2
如今,有我建立test目录,添加这两个文件。目录以下:
s_w_1
如今,我重启服务,访问 http://localhost:8080/test/aaaa.jpg 出现404
s_w_4html

打开target目录以下
s_w_5
能够看到静态static下没有test目录。因此,404很正常。spring

解决办法,在pom文件添加build以下:springboot

s_w_6
删除,再添加文件,重启服务。页面能够访问了。ide

有问题,请留言!ui

我的博客地址: https://blog.ailijie.top/arch...idea

相关文章
相关标签/搜索