Esempio n. 1
0
 /**
  * Method to pre-create all beans scoped as SINGLETON or the beans with init-on-load set to TRUE
  * during the first time application boot
  *
  * @param ContextReader $contextReader
  *
  * return void
  */
 private function initBeans(ContextReader $contextReader)
 {
     $this->logger->debug('Pre-Load all init-on-boot beans');
     $beansToPreload = $contextReader->getInitBeans();
     $this->preLoadedBeansRepository = new SimplePreLoadedBeansRepositoryImpl();
     if ($beansToPreload != null) {
         foreach ($beansToPreload as $bean) {
             try {
                 $this->preLoadedBeansRepository->addBean($bean, $this->coreContainer->getBean($bean));
             } catch (OvoContainerException $e) {
                 $this->coreContainer->close();
                 throw new OvoLoaderException($e->getMessage());
             }
         }
     }
 }