这几天一直被一个问题困扰,每次springboot的tomcat启动以后, 而后过了一段时间看, 进程就忽然本身关闭掉了。 而后日志是:web
ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6d5380c2: startup date [Sun Sep 24 17:51:04 CST 2017]; root of context hierarchy o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
网上也有说这个问题, 可是大多数说的是, 这个是一个非 web应用, 须要添加这个依赖,连接spring
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
要么就是添加tomcat的依赖。tomcat
可是搞了不少次发现原来是怎么样,就是怎么样, 直到看到这篇文章 , 才发现,原来是启动方式的问题, 须要加 nohup, 而后加了 nohup, 果真就行了。这也纠正了个人一个误区, 我一直觉得 & 和 nohup是同样的。springboot
能够参考这篇文章
简单来讲就是:app