java - spring boot 应用程序重新启动并显示消息“Tomcat 已启动”
问题描述
我有一个 spring-boot 应用程序(spring-boot 1.5.9.RELEASE),它会在任何时间点随机重启(或者看起来像是从日志中重启)。请参阅下面的日志。
- 我没有启用 devtools
- 我没有启用 jmxremote
- 我不调用 make /refresh 调用
- 我确实使用弹簧云配置
但应用程序仍会在不到一小时内重新启动(有时在 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 ... ... ...
解决方案
如果你想确保你的 Spring Boot 应用程序中没有启动 Web 服务器,你可以设置以下配置键
spring.main.web-environment=false 或者你可以使用 SpringApplicationBuilder
新的 SpringApplicationBuilder(YourApp.class) .web(false).run(args);
推荐阅读
- linux - 通过sed替换方括号内的多行代码
- java - JPA 和 JTA 同步
- sql-server - Sql 在空闲时间后重置我的池连接
- javascript - 如何将数组从控制器传递到 _layout.cshtml
- android - 如何在 TextInputLayout 内的 EditText 上设置高程
- android - 如何通过具有不可序列化数据的意图传递数组或数组列表?
- vba - VBA。访问 Variant 的数组元素。数组是类属性
- python - 使用 Python Tkinter 2.7 在选定路径中创建目录
- html5-fullscreen - 在任何元素上初始化全屏时没有任何效果
- ios - 如何在 CBPeripheralManager 处于活动状态时提高 CBCentralManager 的性能