Springboot

Springboot启动问题
通过方法1主程序类main方法启动报错:
Error:(3, 47) java: 程序包org.springframework.web.bind.annotation不存在
Error:(4, 46) java: 程序包org.springframework.boot.autoconfigure不存在

@SpringBootApplication
public class Springboothello4Application {

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

}

img

通过方法2启动却成功:
mvn clean compile
mvn insrall
mvn spring-boot:run

img

这是 什么原因

你构建一下项目再直接run试试,build project

  • 关于该问题,我找了一篇非常好的博客,你可以看看是否有帮助,链接:Springboot异常处理