解决:springboot访问static 404

springboot 遇到不能访问静态资源的情况

首先springboot 是默认访问static的 引用JS CSS 路径不需要带上static
如果8080直接访问静态资源 404

This application has no explicit mapping for /error, so you are seeing this as a fallback.
出现这种错误 访问controller一般是没问题的 是静态资源没有加载到tomcat中

看了其他帖子有说在properties中配置路径的 其实现在springboot不需要特地配置 默认映射到static了

把Build project automatically这个勾上

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43469680/article/details/107022315