报错解决方法——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文件是否存在


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


相关推荐
白露与泡影2 小时前
Spring事件机制完全指南:解耦利器与实战
java·后端·spring
好好沉淀2 小时前
Spring AI Alibaba
java·人工智能·spring
栗子叶2 小时前
Spring 中 Servlet 容器和 Python FastAPI 对比
python·spring·servlet·fastapi
雪人.2 小时前
Spring常见面试题(2026版30道面试题)
java·后端·spring
一代明君Kevin学长3 小时前
记录一个上手即用的Spring全局返回值&异常处理框架
java·网络·python·spring
Mr.朱鹏4 小时前
Spring Boot 配置文件加载顺序与优先级详解
java·spring boot·后端·spring·maven·配置文件·yml
沛沛老爹4 小时前
基于Spring Retry实现的退避重试机制
java·开发语言·后端·spring·架构
码头整点薯条4 小时前
License 集成 Spring Gateway:解决 WebFlux 非阻塞与 Spring MVC Servlet 阻塞兼容问题
java·spring
白露与泡影4 小时前
Spring 的西西弗斯之石:理解 BeanFactory、FactoryBean 与 ObjectFactory
java·后端·spring
忧郁的Mr.Li5 小时前
Spring+Mybatis配置自定义线程事务管理
java·spring·mybatis