Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Async Bean initialization

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".

like image 203
f.khantsis Avatar asked Nov 08 '22 04:11

f.khantsis


1 Answers

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:

  • https://jira.spring.io/browse/SPR-8767
  • https://jira.spring.io/browse/SPR-13732
like image 172
Grim Avatar answered Nov 15 '22 06:11

Grim