List of usage examples for org.springframework.beans.factory.support BeanDefinitionValidationException BeanDefinitionValidationException
public BeanDefinitionValidationException(String msg, Throwable cause)
From source file:org.bigtester.ate.model.data.CaseDataProcessor.java
/** * {@inheritDoc}/*from ww w .ja v a2 s.com*/ */ @Override public void postProcessBeanFactory(@Nullable ConfigurableListableBeanFactory beanFactory) throws BeansException { if (beanFactory == null) throw new IllegalStateException("Spring Container initialization error"); String[] homePageNames = beanFactory.getBeanNamesForType(Homepage.class, true, false); String[] lastPageNames = beanFactory.getBeanNamesForType(Lastpage.class, true, false); String[] regularPageNames = beanFactory.getBeanNamesForType(RegularPage.class, true, false); allPageNames = ArrayUtils.addAll(homePageNames, lastPageNames); allPageNames = ArrayUtils.addAll(allPageNames, regularPageNames); for (int i = 0; i < getAllPageNames().length; i++) { pageBeanDefs.add(beanFactory.getBeanDefinition(getAllPageNames()[i])); } for (int j = 0; j < pageBeanDefs.size(); j++) { if (null != pageBeanDefs.get(j).getPropertyValues() .getPropertyValue(XsdElementConstants.ATTR_BASEPAGEOBJECT_DATAFILE)) { caseDataFiles.add(new FileSystemResource((String) pageBeanDefs.get(j).getPropertyValues() .getPropertyValue(XsdElementConstants.ATTR_BASEPAGEOBJECT_DATAFILE).getValue())); } } if (!caseDataFiles.isEmpty()) { dbInit = GlobalUtils.findDBInitializer(beanFactory); try { getDbInit().setInitXmlFiles(caseDataFiles); } catch (IOException e) { throw new BeanDefinitionValidationException("Page data file in page attribute can't be read!", e); } try { getDbInit().initialize(beanFactory); } catch (MalformedURLException | DatabaseUnitException | SQLException e) { throw new FatalBeanException("Case database creation error!", e); } } }