解决:Web application could not be started as there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context. 一·问题描述:1.启动一个web服务报如图所示异常:2.项目的pom依赖也是添加了web场景启动依赖 二·问题原因:1.Springboot的主启动类是自己写的,后面改了一下类名,但是main方法中的这行代码中类名没改过来:`SpringApplication.run(本主启动类名.class, args);`三·解决办法:1.检查是否有`spring-boot-starter-web`场景启动器依赖2.检查主启动类代码:Springboot启动类注解、代码细节类名问题 四·验证:启动服务成功! 一·问题描述: 1.启动一个web服务报如图所示异常: 2.项目的pom依赖也是添加了web场景启动依赖 二·问题原因: 1.Springboot的主启动类是自己写的,后面改了一下类名,但是main方法中的这行代码中类名没改过来:SpringApplication.run(本主启动类名.class, args); 三·解决办法: 1.检查是否有spring-boot-starter-web场景启动器依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> 2.检查主启动类代码:Springboot启动类注解、代码细节类名问题 四·验证:启动服务成功!