/** * Pre-initialize the factory from the XML file. * Only effective if caching is enabled. */ @Override public void afterPropertiesSet() throws BeansException { if (isCache()) { initFactory(); } }
/** * Pre-initialize the factory from the XML file. * Only effective if caching is enabled. */ @Override public void afterPropertiesSet() throws BeansException { if (isCache()) { initFactory(); } }
/** * Initialize the view bean factory from the XML file. * Synchronized because of access by parallel threads. * @throws BeansException in case of initialization errors */ protected synchronized BeanFactory initFactory() throws BeansException { if (this.cachedFactory != null) { return this.cachedFactory; } ApplicationContext applicationContext = obtainApplicationContext(); Resource actualLocation = this.location; if (actualLocation == null) { actualLocation = applicationContext.getResource(DEFAULT_LOCATION); } // Create child ApplicationContext for views. GenericWebApplicationContext factory = new GenericWebApplicationContext(); factory.setParent(applicationContext); factory.setServletContext(getServletContext()); // Load XML resource with context-aware entity resolver. XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); reader.setEnvironment(applicationContext.getEnvironment()); reader.setEntityResolver(new ResourceEntityResolver(applicationContext)); reader.loadBeanDefinitions(actualLocation); factory.refresh(); if (isCache()) { this.cachedFactory = factory; } return factory; }
/** * Initialize the view bean factory from the XML file. * Synchronized because of access by parallel threads. * @throws BeansException in case of initialization errors */ protected synchronized BeanFactory initFactory() throws BeansException { if (this.cachedFactory != null) { return this.cachedFactory; } ApplicationContext applicationContext = obtainApplicationContext(); Resource actualLocation = this.location; if (actualLocation == null) { actualLocation = applicationContext.getResource(DEFAULT_LOCATION); } // Create child ApplicationContext for views. GenericWebApplicationContext factory = new GenericWebApplicationContext(); factory.setParent(applicationContext); factory.setServletContext(getServletContext()); // Load XML resource with context-aware entity resolver. XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); reader.setEnvironment(applicationContext.getEnvironment()); reader.setEntityResolver(new ResourceEntityResolver(applicationContext)); reader.loadBeanDefinitions(actualLocation); factory.refresh(); if (isCache()) { this.cachedFactory = factory; } return factory; }
/** * Pre-initialize the factory from the XML file. * Only effective if caching is enabled. */ @Override public void afterPropertiesSet() throws BeansException { if (isCache()) { initFactory(); } }
/** * Initialize the view bean factory from the XML file. * Synchronized because of access by parallel threads. * @throws BeansException in case of initialization errors */ protected synchronized BeanFactory initFactory() throws BeansException { if (this.cachedFactory != null) { return this.cachedFactory; } Resource actualLocation = this.location; if (actualLocation == null) { actualLocation = getApplicationContext().getResource(DEFAULT_LOCATION); } // Create child ApplicationContext for views. GenericWebApplicationContext factory = new GenericWebApplicationContext(); factory.setParent(getApplicationContext()); factory.setServletContext(getServletContext()); // Load XML resource with context-aware entity resolver. XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); reader.setEnvironment(getApplicationContext().getEnvironment()); reader.setEntityResolver(new ResourceEntityResolver(getApplicationContext())); reader.loadBeanDefinitions(actualLocation); factory.refresh(); if (isCache()) { this.cachedFactory = factory; } return factory; }