Async Bean initialization

3.3k views Asked by At

Initialization of a specific bean requires performing a network connection. This may take some time, and unnecessarily blocks the already long startup by a few seconds.

Is there any way for my bean to signal that it isn't yet initialized even after it exits the constructor, and then later, when it's ready, signal to the context that it now IS ready and it's status should be moved to "initialized".

1

There are 1 answers

2
Grim On

Well, there is a task for non-lazy beans for Spring5x. Spring 5 is out now, but the ticket is unresolved yet.

Similar problems have been resolved years before like the bootstrap of database connection. If this does not solve your main problem, please be patient for later releses of Spring 5.

References: