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括号中使用当前类的类名。

@SpringBootApplication
public class HazqwebApplication {

    public static void main(String[] args) {
        SpringApplication.run(HazqwebApplication.class, args);
    }

}

2.2、pom.xml中配置类必须配置如下

springboot-boot-starter-web这个是启动的必须要配置,不能缺少。

下面提供一个开发常用的pom.xml配置包

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <a
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

雾林小妖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值