原因1: 有可能是没有加spring-boot-starter-web依赖,在pom里添加依赖即可。 原因2: run函数写错了,如启动类为Main,则为SpringApplication.run(Main.class,args);初学者易把启动类默认为main