I have a spring application and there is a scheduled logic which produces prototype beans at fixed rate.
Everything works fine on my laptop but after deploying it to server my app fails to start due to:
2016-12-13 04:13:01.885 ERROR 4688 --- [TaskScheduler-1] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task.
...
BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'metaDataSourceAdvisor': Singleton bean creation not allowed
while the singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
...
This is the first scheduled call. Looks like a timing issue. On my laptop application initializes much faster and nothing wrong happens for the first scheduled call (which produces prototype beans).
Is there a way to get to know the current state of Spring bean creation flow so I can check it in scheduled logic and produce nothing when app creation is not finished?
Thanks!