List of usage examples for org.springframework.beans FatalBeanException FatalBeanException
public FatalBeanException(String msg, @Nullable Throwable cause)
From source file:com.teradata.benchto.driver.utils.PropertiesUtils.java
public static <T> T resolveEnvironmentProperties(ConfigurableEnvironment environment, Class<T> clazz, String prefix) {//from w ww.java2 s . c o m try { T properties = BeanUtils.instantiate(clazz); PropertiesConfigurationFactory<T> factory = new PropertiesConfigurationFactory<T>(properties); factory.setTargetName(prefix); factory.setPropertySources(environment.getPropertySources()); factory.setConversionService(environment.getConversionService()); factory.bindPropertiesToTarget(); return properties; } catch (BindException ex) { throw new FatalBeanException("Could not bind " + clazz + " properties", ex); } }
From source file:com.capgemini.boot.core.factory.internal.SpringBootSettingsResolver.java
@SuppressWarnings("unchecked") @Override/*from ww w. j a v a 2s. c o m*/ public <T> T resolveSettings(Class<T> settingsClass, String prefix, ConfigurableEnvironment environment) { try { T newSettings = (T) Class.forName(settingsClass.getName()).newInstance(); PropertiesConfigurationFactory<Object> factory = new PropertiesConfigurationFactory<Object>( newSettings); factory.setTargetName(prefix); factory.setPropertySources(environment.getPropertySources()); factory.setConversionService(environment.getConversionService()); factory.bindPropertiesToTarget(); return newSettings; } catch (Exception ex) { throw new FatalBeanException("Could not bind DataSourceSettings properties", ex); } }
From source file:edu.internet2.middleware.shibboleth.common.config.security.FilesystemBasicCredentialBeanDefinitionParser.java
/** {@inheritDoc} */ protected byte[] getEncodedPrivateKey(String keyConfigContent) { try {/*from ww w. j a v a2 s.c o m*/ FileInputStream ins = new FileInputStream(keyConfigContent); byte[] encoded = new byte[ins.available()]; ins.read(encoded); return encoded; } catch (IOException e) { throw new FatalBeanException("Unable to read private key from file " + keyConfigContent, e); } }
From source file:edu.internet2.middleware.shibboleth.common.config.security.FilesystemPKIXValidationInformationBeanDefinitionParser.java
/** {@inheritDoc} */ protected byte[] getEncodedCRL(String certCRLContent) { try {/* w w w . j av a2 s.com*/ FileInputStream ins = new FileInputStream(certCRLContent); byte[] encoded = new byte[ins.available()]; ins.read(encoded); return encoded; } catch (IOException e) { throw new FatalBeanException("Unable to read CRL(s) from file " + certCRLContent, e); } }
From source file:edu.internet2.middleware.shibboleth.common.config.security.FilesystemBasicCredentialBeanDefinitionParser.java
/** {@inheritDoc} */ protected byte[] getEncodedSecretKey(String keyConfigContent) { try {/*from ww w. j a va 2s . c o m*/ FileInputStream ins = new FileInputStream(keyConfigContent); byte[] encoded = new byte[ins.available()]; ins.read(encoded); return encoded; } catch (IOException e) { throw new FatalBeanException("Unable to read secret key from file " + keyConfigContent, e); } }
From source file:edu.internet2.middleware.shibboleth.common.config.security.FilesystemPKIXValidationInformationBeanDefinitionParser.java
/** {@inheritDoc} */ protected byte[] getEncodedCertificate(String certConfigContent) { try {//from w w w. j a v a 2 s .c om FileInputStream ins = new FileInputStream(certConfigContent); byte[] encoded = new byte[ins.available()]; ins.read(encoded); return encoded; } catch (IOException e) { throw new FatalBeanException("Unable to read certificate(s) from file " + certConfigContent, e); } }
From source file:edu.internet2.middleware.shibboleth.common.config.security.FilesystemBasicCredentialBeanDefinitionParser.java
/** {@inheritDoc} */ protected byte[] getEncodedPublicKey(String keyConfigContent) { try {/* www.j av a 2s . c om*/ FileInputStream ins = new FileInputStream(keyConfigContent); byte[] encoded = new byte[ins.available()]; ins.read(encoded); return encoded; } catch (IOException e) { throw new FatalBeanException("Unable to read public key from file " + keyConfigContent, e); } }
From source file:it.cosenonjaviste.alfresco.annotations.processors.runtime.AbstractPostProcessorConfigurer.java
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames(); for (String definitionName : beanDefinitionNames) { try {//from w ww.java 2s . com final BeanDefinition bd = beanFactory.getBeanDefinition(definitionName); final String beanClassName = bd.getBeanClassName(); if (StringUtils.hasText(beanClassName)) { try { processBeanDefinition(beanFactory, bd, beanClassName, definitionName); } catch (Exception e) { logger.error(e.getMessage(), e); throw new FatalBeanException("Unknown class defined.", e); } } } catch (NoSuchBeanDefinitionException ex) { logger.warn(ex.getMessage()); continue; } } }
From source file:org.alloy.metal.xml.merge.MergeXmlConfigResource.java
public Resource getMergedConfigResource(List<ResourceInputStream> sources) throws BeansException { Resource configResource = null; ResourceInputStream merged = null;//from w ww . java2 s . com try { merged = merge(sources); // read the final stream into a byte array ByteArrayOutputStream baos = new ByteArrayOutputStream(); boolean eof = false; while (!eof) { int temp = merged.read(); if (temp == -1) { eof = true; } else { baos.write(temp); } } configResource = new ByteArrayResource(baos.toByteArray()); if (LOG.isDebugEnabled()) { LOG.debug("Merged config: \n" + serialize(configResource)); } } catch (MergeException e) { throw new FatalBeanException("Unable to merge source and patch locations", e); } catch (MergeManagerSetupException e) { throw new FatalBeanException("Unable to merge source and patch locations", e); } catch (IOException e) { throw new FatalBeanException("Unable to merge source and patch locations", e); } finally { if (merged != null) { try { merged.close(); } catch (Throwable e) { LOG.error("Unable to merge source and patch locations", e); } } } return configResource; }
From source file:com.apporiented.spring.override.AbstractGenericBeanDefinitionParser.java
public AbstractGenericBeanDefinitionParser(String className) { try {//from w w w . j ava 2 s . co m beanClass = Class.forName(className); } catch (ClassNotFoundException e) { throw new FatalBeanException("Can't find the bean class", e); } catch (NoClassDefFoundError e) { enabled = false; log.warn("Turning off support for " + className + " elements due to a missing dependency: " + e.getMessage()); } }