报错解决方法——http404(Spring MVC)

一.检查静态资源是否加载成功

成功的标志就是在项目跑起来之后再target文件夹中的classes文件夹中可以找到自己写的配置文件。

1.查看resources文件夹是否被识别为资源文件夹

如图所示,文件夹图标右下角有三条杠代表被识别为资源文件

2.在pox.xml文件中插入如下代码进行识别

xml 复制代码
		<resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>

二.检查各个类中路径是否正确

1.jsp中的超链接跳转路径

2.根据跳转路径寻找对应的Controller类方法

3.查看Controller类方法最后跳转的jsp文件是否存在


三.检查扫描器是否扫描到文件所在包


相关推荐
江南十四行1 小时前
Spring框架核心(上)——IoC控制反转与DI依赖注入详解
java·后端·spring
乐观的Terry5 小时前
11、发布系统-用户认证与权限体系
java·spring boot·spring·spring cloud·mybatis
ruleslol8 小时前
如何解决 Spring 中的循环依赖问题?
spring
Flittly10 小时前
【我的手搓轮子日记】(2)handmade-ioc 手搓 IOC 容器
java·spring boot·spring
程序员钟霖10 小时前
【实战版】Spring IOC 控制反转详解
java·后端·spring·maven·intellij-idea
玖石书11 小时前
ASP.NET Core迁移Spring系列:运行时与 GC 篇
后端·spring·asp.net
钱六两11 小时前
Spring AI 使用 MCP 客户端(调用高德 MCP)
java·人工智能·spring
敲代码的嘎仔13 小时前
从零搭建微服务:Spring Cloud Alibaba 全家桶踩坑实录(Nacos + OpenFeign + Gateway + Sentinel)
java·spring boot·spring·spring cloud·微服务·gateway·sentinel
玖石书1 天前
ASP.NET Core 迁移至 Spring系列:编译生态篇
后端·spring·asp.net
Jul1en_1 天前
【Java 脚手架】封装通用工具类-1
java·spring boot·分布式·spring·spring cloud