Spring Boot 项目编译时提示错误 cannot access WebApplicationInitializer 错误
2023-09-27 14:20:34 时间
具体的提示信息如下:
Error:(21, 8) java: cannot access org.springframework.web.WebApplicationInitializer class file for org.springframework.web.WebApplicationInitializer not found
这个错误要结合你的 Application 代码来看。
因为在 Application 的代码中,我们继承了 SpringBootServletInitializer。
请注意:我们定义的 Application:
public class Application extends SpringBootServletInitializer{ }
正是因为这个定义,所以你的 POM 或者 build.gradle 中 需要添加:spring-boot-starter-web 依赖。
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>2.2.6.RELEASE</version> </dependency>
然后你再次编译的项目,你就不会有提示编译错误了。
https://www.cwiki.us/display/SpringBootZH/questions/57939020
相关文章
- Spring 定时任务报错:Cron expression must consist of 6 fields (found 5 in “0 * * * *“)
- 阿里四面:你知道Spring AOP创建Proxy的过程吗?
- Spring 项目运行提示错误 Not a managed type
- Spring Boot 进行测试提示 TestContextAnnotationUtils 错误
- Spring Batch 源代码进行编译的时候提示仓库错误
- Spring 数据初始 H2 后进行数据查询提示 Schema not found 错误
- Spring 日志输出错误字符 -e[0;39m e[2m[
- Spring boot 启动提示数据源错误
- 通用权限管理系统(菜单>按钮级别的权限)含jwt+spring security+redis
- Spring MVC学习之三:处理方法返回值的可选类型
- Spring Boot 如何快速集成 Redis?
- Spring Cloud 升级最新 Finchley 版本,踩了所有的坑!
- 反对抄袭 正解spring的@Autowired 不要相信网上的错误版本
- Spring如何加载XSD文件(org.xml.sax.SAXParseException: Failed to read schema document错误的解决方法)
- 构建微服务:Spring boot 入门篇
- Spring 项目 @ModelAttribute 绑定属性乱码
- Spring Boot 2.0下配置Log4j2下的错误问题分析与解决
- springboot2.0.2+redis+spring-session 解决session共享的问题
- Spring Boot 2下使用Feign找不到@EnableFeignClients的解决办法
- Spring学习5-Spring整合JDBC及其事务处理(注解方式)
- spring boot 实现密码连续输入错误5次,限制十分钟内不能进行登录
- 手把手带你入门 Spring Security!
- Spring Batch ItemProcessor组件-自定义处理器