DMT82
DMT82

Reputation: 881

DevTools restarts twice in Intellij

I'm starting a new Spring Boot 2.4.2 application in Intellij and have DevTools added.
The Spring Boot is created in spring.io's homepage and not through Intellij.
In Preferences -> Build, Execution, Deployment -> Compiler, I have checked: Build project automatically.
Then I search for Registry... in Help -> Find Actions and search for: compiler.automake.allow.when.app.running, and checked that too.

I start the Spring application as normal, and it starts in 4 seconds.
I have some output-text in the Main-class and save that file, but it runs Spring Boot twice.
First it runs Spring Boot and then shuts it down and then runs it again.

Thread-19] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' Thread-19] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
Thread-19] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down' Thread-19] o.s.b.f.support.DisposableBeanAdapter : Invocation of destroy method failed on bean with name 'inMemoryDatabaseShutdownExecutor':
org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database is already 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 - Shutdown initiated... Thread-19] com.zaxxer.hikari.HikariDataSource
: HikariPool-4 - Shutdown completed.

After this it start the Spring Boot application again.
First it starts it up in 1.0 seconds and then shuts it down to restart it again and second time it goes up in 0.6 seconds, but I don't get why it runs the Spring application twice when i saved it once.

I'm on a Mac-Catalina and running Intellij 2020.3.1 and Spring Boot 2.4.2

Upvotes: 4

Views: 1483

Answers (1)

David Kerwick
David Kerwick

Reputation: 538

See here https://github.com/spring-projects/spring-boot/issues/25269

Which suggests increasing the quiet period

spring.devtools.restart.quiet-period=900

Which stopped the double load for me

Upvotes: 6

Related Questions