How to make Spring server to start even if database is down?

You can set:

spring.sql.init.continue-on-error=true

in your application.properties.

According to the Spring Boot 2.5.5 user guide:

By default, Spring Boot enables the fail-fast feature of its script-based database initializer. This means that, if the scripts cause exceptions, the application fails to start. You can tune that behavior by setting spring.sql.init.continue-on-error.

P.S.: Before Spring Boot 2.5, the property was named spring.datasource.continue-on-error.

Leave a Comment