Skip to content
Advertisement

Making a Spring Boot Configuration Fault Tolerant [closed]

I have a Spring Boot Application that relies on various services like Keycloak, Elastic Stack, and PostgreSQL. This application will be deployed to an Kubernetes cluster along with a number of other applications. Is it possible to cause my application to be tolerant of services that may not be available? Imagine if PostgreSQL wasn’t up at boot time. Can I force the application to start in a degraded state, notifying the user, log the error, and notifying any calling application of the service degradation? It would also be useful if it could retry auto configuring such beans at an interval.

Advertisement

Answer

Aren’t you asking about @Retryable and @Recover? There’s also @Lazy, but the first 2 are probably exactly what you want. That’s assuming that your beans don’t have retry built in. I.e. the Kafka beans retry automatically. If you are talking rest apis, I’d probably use something like Eureka, Circuit Breaker, etc.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement