Web application could not be started as there was no org.springframework.boot.web.servlet.server.Ser
1、问题概述?
启动springboot工程的时候,报错了,我总结了三点原因
Web application could not be started as there was no org.springframework.boot.web.servlet.server.ServletWebServerFactory bean defined in the context.
Action:
Check your applications dependencies for a supported servlet web server.
Check the configured web application type.
process finished with exit code 1
原因1:启动类问题
原因2:缺少配置
原因3:配置冲突
2、如何解决这个问题?
2.1、启动类注意点
1、需要使用注解@SpringBootApplication
2、SpringApplication.run括号中使用当前类的类名。
@SpringBootApplicationpublic class HazqwebApplication { public static void main(String[] args) { SpringApplication.run(HazqwebApplication.class, args); }}
2.2、pom.xml中配置类必须配置如下
springboot-boot-starter-web这个是启动的必须要配置,不能缺少。
下面提供一个开发常用的pom.xml配置包
4.0.0 org.springframework.boot <a