这个错误是因为在您的项目中缺少'javax.servlet.http.HttpServletRequest'类。该类通常由Servlet API提供。

要解决这个问题,您可以添加Servlet API依赖项到您的pom.xml文件中。添加以下依赖项:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>4.0.1</version>
    <scope>provided</scope>
</dependency>

添加完依赖项后,重新构建并启动您的Spring Boot项目,该错误应该就会消失。

Spring Boot启动报错:java.lang.TypeNotPresentException: Type javax.servlet.http.HttpServletRequest not present

原文地址: https://www.cveoy.top/t/topic/bNSe 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录