Search code examples
javaspringinfluxdbreconnect

influxdb failed cause spring application run failed


I use spring auto-configure to connect influxdb in a spring boot command line application.

the application will run failed, when influxdb is suddenly down.

I Autowired the Influxdb instance in Application, and when inflxudb is down, my application runs failed.

I didn't find any information about reconnecting to influxdb in influx-java or spring auto-configure.

How should I config to reconnect to the influxdb?


Solution

  • You didn't paster your code, but I think if your db connection faild cause your spring application failed, it usually means, you did NOT catch all of your exception and throw to upper level, and at last spring framework can't handle the exception and run failed.

    So check your code around the database action, and catch all the exception, I think , at least, your spring application will not failed.

    If you have any question, please show us your code.