参考别人给出的文章,实践中发现问题,缺少包
common 模块下的
<dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> </dependency>
这个要去掉,改为
<dependency> <groupId>jakarta.servlet</groupId> <artifactId>jakarta.servlet-api</artifactId> <version>5.0.0</version> <scope>provided</scope> </dependency>
否则 import jakarta.servlet.http.HttpServletResponse;无法导入