问题描述
http://start.spring.io/
官网生成的sprin-boot 1.15版本的工程,直接使用命令 mvn:clean spring-boot:run 启动,项目报错并结束
报错信息:
2018-05-28 14:07:40.548 INFO 7840 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@4620a160: startup date [Mon May 28 14:07:39 CST 2018]; root of context hierarchy
2018-05-28 14:07:40.549 INFO 7840 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
问题原因
生成项目是没有引入web相关的spring-boot提供支持的jar包
解决办法
在pom文件中引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>