Example usage for org.springframework.beans.factory BeanInitializationException BeanInitializationException

List of usage examples for org.springframework.beans.factory BeanInitializationException BeanInitializationException

Introduction

In this page you can find the example usage for org.springframework.beans.factory BeanInitializationException BeanInitializationException.

Prototype

public BeanInitializationException(String msg) 

Source Link

Document

Create a new BeanInitializationException with the specified message.

Usage

From source file:org.jsconf.core.ConfigurationFactory.java

public ConfigurationFactory withBean(Class<?> bean) {
    if (bean.isAnnotationPresent(ConfigurationProperties.class)) {
        ConfigurationProperties cf = bean.getAnnotation(ConfigurationProperties.class);
        return withBean(cf.value(), bean, cf.id(), cf.proxy());
    }//w w w.  j  av  a2 s .c  o  m
    throw new BeanInitializationException(
            String.format("Missing @ConfigurationProperties annotation on class %s", bean));
}

From source file:org.constretto.spring.ConstrettoSingletonFactoryBean.java

private Object getResolvedBean() {
    Object bean = null;//w ww. j av a  2s . c om
    if (!assemblyContextResolver.getAssemblyContext().isEmpty()) {
        for (String currentEnvironment : assemblyContextResolver.getAssemblyContext()) {
            bean = beans.get(currentEnvironment);
            if (null != bean) {
                break;
            }
        }
    }

    if (bean == null) {
        bean = defaultBean;
    }

    if (bean == null) {
        throw new BeanInitializationException("No bean assosiated with the prefix "
                + assemblyContextResolver.getAssemblyContext() + ", and no default bean could be found");
    }
    return bean;
}

From source file:org.constretto.spring.ConstrettoSingletonFactoryBean.java

public Class<?> getObjectType() {
    if (null == beans) {
        throw new BeanInitializationException("At least one implementation of the service is mandatory");
    }//  www .j a v  a  2  s  .  c  o m

    return getResolvedBean().getClass();
}

From source file:com.edgenius.wiki.service.impl.SitemapServiceImpl.java

@Override
public void afterPropertiesSet() throws Exception {
    if (!mapResourcesRoot.exists() && !mapResourcesRoot.getFile().mkdirs()) {
        throw new BeanInitializationException("Failed creating public sitemap location.");
    }/*from ww w. j a v a2s  .  c om*/

    //copy existed sitemap file to explode directory
    File robotFile = new File(mapResourcesRoot.getFile(), ROBOTS_TXT);
    if (!robotFile.exists()) {
        FileUtils.writeStringToFile(robotFile,
                "Sitemap: " + WebUtil.getHostAppURL() + SITEMAP_URL_CONTEXT + SITEMAP_INDEX_NAME);
    }

    metadata = SitemapMetadata.load(mapResourcesRoot.getFile());

    try {
        this.createSitemap();
    } catch (IOException e) {
        log.info("Site map is not recreate in same day");
    }
}

From source file:de.codesourcery.eve.skills.production.impl.FileBlueprintLibrary.java

@Override
public void afterPropertiesSet() throws Exception {
    if (inputFile == null) {
        throw new BeanInitializationException("inputFile cannot be NULL");
    }/* w w  w  . j a v a 2s. co  m*/
}

From source file:de.codesourcery.eve.skills.production.ShoppingListManager.java

@Override
public void afterPropertiesSet() throws Exception {
    if (this.shoppingListDAO == null) {
        throw new BeanInitializationException("shoppingListDAO needs to be set");
    }/*from  w ww  . ja  va  2  s . co m*/
}

From source file:org.geowebcache.seed.TileBreeder.java

@SuppressWarnings("serial")
private void checkPositive(long value, String variable) {
    if (value < 0) {
        throw new BeanInitializationException("Invalid configuration value for environment variable " + variable
                + ". It should be a positive integer.") {
        };//w  ww.  j  av a  2 s.  c om
    }
}

From source file:com.edgenius.wiki.service.impl.ExportServiceImpl.java

public void afterPropertiesSet() throws Exception {
    //TODO: this will leave a lots of temporary directories
    //create a temporary directory for final target zip file
    targetDir = FileUtil.createTempDirectory(TMP_EXPORT_TARGET);
    File dir = new File(targetDir);
    if (dir.exists() && !dir.isDirectory())
        throw new BeanInitializationException(
                "Unable to create temporary directory for export use:" + targetDir);

    dir.mkdirs();//from ww  w  . java  2s  .  c o m
}

From source file:de.codesourcery.eve.skills.dao.impl.FileShoppingListDAO.java

@Override
public void afterPropertiesSet() throws Exception {
    if (dataFile == null) {
        throw new BeanInitializationException("dataFile not set");
    }// w w w. ja v a  2s  .  c  o  m

    if (dataModel == null) {
        throw new BeanInitializationException("dataModel not set");
    }
}

From source file:com.edgenius.wiki.service.impl.SettingServiceImpl.java

public void afterPropertiesSet() throws Exception {
    if (globalConf == null) {
        throw new BeanInitializationException("Must assign global setting configure XML file");
    }//  w  ww  .j  av a  2s  .c om

    if ("true".equals(System.getProperty("rebuild.global.xml"))) {
        try {
            GlobalSetting setting = new GlobalSetting();
            Global.syncTo(setting);
            saveOrUpdateGlobalSetting(setting);
        } catch (SettingServiceException e) {
            log.error("System try to create a global XML configure file, but failed with error.", e);
        }
        System.setProperty("rebuild.global.xml", "");
    }
}