今天在公司的新电脑上又重新搭建一套SpringBoot,本次记录的只是在启动的时候遇到的一个小问题,
就是启动即关闭的问题,如果eclipse要搭建SpringBoot要下载一个STS插件,很方便,自动构建Springboot项目,但是这次构建却和之前的不一样,就是通过main方法启动之后控制台显示启动之后就关闭了,内容如下:
2018-08-25 11:30:08.369 INFO 10908 --- [main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-08-25 11:30:08.389 INFO 10908 --- [main] c.e.demo.SpringBootDemo2Application: Started SpringBootDemo2Application in 1.696 seconds (JVM running for 4.94)
2018-08-2511:30:08.394INFO10908---[Thread-15]s.c.a.AnnotationConfigApplicationContext:Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@4c7a078: startup date [Sat Aug 25 11:30:07 CST 2018]; root of context hierarchy
2018-08-25 11:30:08.399 INFO 10908 --- [ Thread-15] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
对比了一下之前的初始构建的项目,发现此次构建生成的pom.xml中,少了一个依赖:关于spring-boot-starter-web的:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
引入之后,再启动,就不会被关闭了。