AnsweredAssumed Answered

Delaying initialization of spring beans until repository fully initialized

Question asked by mkolas on Nov 2, 2016
Latest reply on Nov 3, 2016 by kaynezhang

I'm working on installing Solr on an Alfresco 4.1.5 instance that was previously exclusively using Lucene.


As part of our existing customizations, we have a number of beans that extend Alfresco's DictionaryListener and execute Lucene queries onDictionaryInit. However, now with Solr, the beans are not bootstrapping properly because Solr does not allow for queries to be executed until the repository is fully initialized.


Is there any sort of analogous class to DictionaryListener, such as RepositoryListener, that would tell me when it is safe to execute queries? Alternatively, is there any sort of known paradigm to delay the initialization of these beans? I've played around with some wait() and sleep() functionality in a bean that my beans "depends-on" in my context, but the solution seems hacky and isn't working any way.


I also know that queries against the database can be executed during repository bootstrap- but those are only available starting in 4.2. Upgrading is an stretch option, but having to upgrade the repository and then modify a bunch of SearchService code isn't really practical for what is right now a simple proof-of-concept.