gpt4 book ai didi

macos - DevTools 在 Intellij 中重启两次

转载 作者:行者123 更新时间:2023-12-05 02:45:54 26 4
gpt4 key购买 nike

我正在 Intellij 中启动一个新的 Spring Boot 2.4.2 应用程序并添加了 DevTools。
Spring Boot 是在 spring.io 的主页创建的,而不是通过 Intellij。
在 Preferences -> Build, Execution, Deployment -> Compiler 中,我勾选了:Build project automatically。
然后我在“帮助”->“查找操作”中搜索注册表...并搜索:compiler.automake.allow.when.app.running,并也进行了检查。

我正常启动 Spring 应用程序,它会在 4 秒内启动。
我在主类中有一些输出文本并保存该文件,但它运行了两次 Spring Boot。
首先它运行 Spring Boot,然后将其关闭,然后再次运行。

Thread-19] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting downExecutorService 'applicationTaskExecutor' Thread-19]j.LocalContainerEntityManagerFactoryBean : Closing JPAEntityManagerFactory for persistence unit 'default'
Thread-19] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477:Starting delayed evictData of schema as part of SessionFactoryshut-down' Thread-19] o.s.b.f.support.DisposableBeanAdapter: Invocation of destroy method failed on bean with name'inMemoryDatabaseShutdownExecutor':
org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database isalready closed (to disable automatic closing at VM shutdown, add";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-200] Thread-19]com.zaxxer.hikari.HikariDataSource : HikariPool-4 - Shutdowninitiated... Thread-19] com.zaxxer.hikari.HikariDataSource
: HikariPool-4 - Shutdown completed.

在此之后它再次启动 Spring Boot 应用程序。
首先它在 1.0 秒内启动,然后关闭它再次重新启动它,第二次它在 0.6 秒内上升,但我不明白为什么它在我保存一次时运行 Spring 应用程序两次。

我在 Mac-Catalina 上运行 Intellij 2020.3.1 和 Spring Boot 2.4.2

最佳答案

看这里 https://github.com/spring-projects/spring-boot/issues/25269

建议增加静默期

spring.devtools.restart.quiet-period=900

这为我停止了双重负载

关于macos - DevTools 在 Intellij 中重启两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65752311/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com