Issue
Is there any way to skip the failure bean to avoid application startup failed.Let me explain the scenario.
I am creating hazlecast bean on application startup.sometime hazecast server might be not alive.In that time when i am starting the springboot application hazecast instance gets failed so that application startup also gets failed.
Error creating bean with name 'hazelcastInstance' [restartedMain] ERROR org.springframework.boot.SpringApplication , reportFailure:771 >> Application startup failed
But My application is not only having hazecast bean ,it also has lot of beans for various services.is there any possibilities to skip the failed beans for application gets started??.
Solution
You can mark them beans with @Lazy
so spring will not construct them on application startup. It will construct them when you use them runtime.
please see this documentation
https://memorynotfound.com/lazy-initialize-autowired-dependencies-with-lazy-annotation/
Answered By - Jayesh