简体   繁体   English

Spring Boot应用程序重新启动,并显示消息“ Tomcat已启动”

[英]spring boot application restarts with message “Tomcat started”

I have a spring-boot application (spring-boot 1.5.9.RELEASE) which restarts (or it looks like restarts from logs) randomly at any point of time. 我有一个spring-boot应用程序(spring-boot 1.5.9.RELEASE),它可以在任意时间点随机重启(或者看起来像从日志重启)。 see logs below. 请参阅下面的日志。

  1. I dont have devtools enabled 我没有启用devtools
  2. I do not have jmxremote enabled 我没有启用jmxremote
  3. I do not call make /refresh call 我不打make / refresh电话
  4. I do use spring cloud config 我确实使用Spring Cloud Config

but still application restarts in less than an hour(sometimes within 3 minutes) 但仍然可以在不到一个小时的时间内(有时在3分钟内)重新启动应用程序

2018-05-28 09:50:43.108  INFO [pool-3-thread-3] myclass1 : myMessage1
2018-05-28 09:50:43.112  INFO [pool-2-thread-2] myclass2 : myMessage2
2018-05-28 09:50:43.118  INFO [pool-1-thread-3] myclass3 : myMessage3
2018-05-28 09:50:43.214  INFO [main] TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2018-05-28 09:50:43.221  INFO [main] Application                      : Started Application ... ... ...

If you want to make sure a web server is not started in your spring boot application, you can set the following configuration key 如果要确保未在Spring Boot应用程序中启动Web服务器,则可以设置以下配置密钥

spring.main.web-environment=false Or you can use the SpringApplicationBuilder spring.main.web-environment = false或者您可以使用SpringApplicationBuilder

new SpringApplicationBuilder(YourApp.class) .web(false).run(args); 新的SpringApplicationBuilder(YourApp.class).web(false).run(args);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM