控制台输出信息如下:
2017-07-13 17:23:16.362 INFO 23232 --- [ main] com.jssz.demo1.Demo1Application : Starting Demo1Application on PP with PID 23232 (W:\WorkSpace\EclipseWorkspace\demo1\target\classes started by Administrator in W:\WorkSpace\EclipseWorkspace\demo1)
2017-07-13 17:23:16.367 INFO 23232 --- [ main] com.jssz.demo1.Demo1Application : No active profile set, falling back to default profiles: default
2017-07-13 17:23:16.534 INFO 23232 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7a36aefa: startup date [Thu Jul 13 17:23:16 CST 2017]; root of context hierarchy
2017-07-13 17:23:17.856 INFO 23232 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-07-13 17:23:17.882 INFO 23232 --- [ main] com.jssz.demo1.Demo1Application : Started Demo1Application in 2.133 seconds (JVM running for 2.865)
2017-07-13 17:23:17.883 INFO 23232 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@7a36aefa: startup date [Thu Jul 13 17:23:16 CST 2017]; root of context hierarchy
2017-07-13 17:23:17.884 INFO 23232 --- [ Thread-2] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
原因是spring boot 框架自集成tomcat,但是未在pom.xml文件中添加tomcat的依赖关系,解决办法如下:
在pom.xml文件中添加如下依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>