這幾天一直被一個問題困擾,每次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