Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Spring Boot application resistant against database connection errors?

I want to make my Spring Boot application robust against database connection errors. If the application starts before the database is available, it should retry to establish the database connection. The same should happen if the database connection gets lost during operation (e. g. database restart, network error ...). And I'm using Flyway migrations, so that Flyway shouldn't start (and throw an exception) until a database connection is available.

How can I do this with Spring Boot (1.5)?

like image 680
deamon Avatar asked Apr 26 '17 20:04

deamon


1 Answers

There is an open ticket for this behavior/issue on the spring-boot tracker https://github.com/spring-projects/spring-boot/issues/4779

like image 131
Pär Nilsson Avatar answered Oct 15 '22 10:10

Pär Nilsson