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

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

Introduction

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

Prototype

public BeanCreationException(String msg) 

Source Link

Document

Create a new BeanCreationException.

Usage

From source file:org.zalando.spring.boot.async.AsyncExecutorConfiguration.java

@Override
public Executor getAsyncExecutor() {
    if (properties.isEnabled()) {
        if (executor != null) {
            return executor;
        } else {/*from w  w w . ja  v a  2 s .c o m*/
            throw new BeanCreationException("Expecting a 'ThreadPoolTaskExecutor' injected, but was 'null'");
        }
    } else {
        log.info(
                "'AsyncExecutorConfiguration' is disabled, so create 'SimpleAsyncTaskExecutor' with 'threadNamePrefix' - '{}'",
                properties.getThreadNamePrefix());
        return new SimpleAsyncTaskExecutor(properties.getThreadNamePrefix());
    }
}

From source file:net.phoenix.thrift.xml.ArgBeanDefinitionParser.java

/**
 * ?arg/*from   w  w  w  . ja v a  2  s. c  o  m*/
 */
@Override
protected void postParse(Element element, ParserContext parserContext, AbstractBeanDefinition current) {
    Object argument = parserContext.getDelegate().parsePropertyValue(element, current, "argument");
    if (argument == null)
        throw new BeanCreationException(
                "Could not found value for arg '" + element.getAttribute("name") + "'.");
    current.getPropertyValues().add("argument", argument);
    // register the definition;
    if (parserContext.isNested()) {
        this.registerBeanDefinition(element, parserContext, current);
    }
}

From source file:com.reactivetechnologies.platform.datagrid.core.HazelcastClusterServiceFactoryBean.java

@PostConstruct
private void setUp() {
    if (StringUtils.isEmpty(entityBasePkg))
        throw new BeanCreationException("'entityBasePkg' not specified in factory bean");
}

From source file:edu.internet2.middleware.shibboleth.idp.config.profile.authn.IPAddressLoginHandlerBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element config, BeanDefinitionBuilder builder) {
    super.doParse(config, builder);

    String username = DatatypeHelper.safeTrimOrNullString(config.getAttributeNS(null, "username"));
    if (username == null) {
        String msg = "No username specified.";
        log.error(msg);//  w w w  .  ja v a 2s. co  m
        throw new BeanCreationException(msg);
    }
    log.debug("authenticated username: {}", username);
    builder.addPropertyValue("authenticatedUser", username);

    List<IPRange> ranges = getIPRanges(config);
    log.debug("registered IP ranges: {}", ranges.size());
    builder.addPropertyValue("ipRanges", ranges);

    boolean defaultDeny = XMLHelper.getAttributeValueAsBoolean(config.getAttributeNodeNS(null, "defaultDeny"));
    log.debug("default deny: {}", defaultDeny);
    builder.addPropertyValue("ipInRangeIsAuthenticated", defaultDeny);
}

From source file:cf.spring.servicebroker.AccessorUtils.java

/**
 * Validates that the method annotated with the specified annotation has a single
 * argument of the expected type./*from w  w w .j av a2 s .  c o m*/
 */
public static void validateArgument(Method method, Class<? extends Annotation> annotationType,
        Class<?> expectedParameterType) {
    if (method.getParameterTypes().length != 1
            || !method.getParameterTypes()[0].equals(expectedParameterType)) {
        throw new BeanCreationException(
                String.format("Method %s with @%s MUST take a single argument of type %s", method,
                        annotationType.getName(), expectedParameterType.getName()));
    }
}

From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.match.basic.OrMatchFunctorBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element configElement, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(configElement, parserContext, builder);

    List<Element> ruleElements = XMLHelper.getChildElementsByTagNameNS(configElement,
            BasicMatchFunctorNamespaceHandler.NAMESPACE, "Rule");

    builder.addConstructorArgValue(/*from w  ww.  j a v a 2  s.  co m*/
            SpringConfigurationUtils.parseInnerCustomElements(ruleElements, parserContext));

    ruleElements = XMLHelper.getChildElementsByTagNameNS(configElement,
            BasicMatchFunctorNamespaceHandler.NAMESPACE, "RuleReference");
    if (!ruleElements.isEmpty()) {
        throw new BeanCreationException("RuleReference elements within an OR rule are not supported");
    }
}

From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.match.basic.AndMatchFunctorBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element configElement, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(configElement, parserContext, builder);

    List<Element> ruleElements = XMLHelper.getChildElementsByTagNameNS(configElement,
            BasicMatchFunctorNamespaceHandler.NAMESPACE, "Rule");

    builder.addConstructorArgValue(/*w ww  .  j a  va  2s . c  om*/
            SpringConfigurationUtils.parseInnerCustomElements(ruleElements, parserContext));

    ruleElements = XMLHelper.getChildElementsByTagNameNS(configElement,
            BasicMatchFunctorNamespaceHandler.NAMESPACE, "RuleReference");
    if (!ruleElements.isEmpty()) {
        throw new BeanCreationException("RuleReference elements within an AND rule are not supported");
    }
}

From source file:edu.internet2.middleware.shibboleth.common.config.attribute.encoding.SAML2Base64AttributeEncoderBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(element, parserContext, builder);

    String namespace = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri";
    if (element.hasAttributeNS(null, "nameFormat")) {
        namespace = DatatypeHelper.safeTrimOrNullString(element.getAttributeNS(null, "nameFormat"));
    }/*from w ww.j  a  va  2  s .  c  o m*/
    builder.addPropertyValue("nameFormat", namespace);

    builder.addPropertyValue("friendlyName", element.getAttribute(FRIENDLY_NAME_ATTRIBUTE_NAME));

    String attributeName = DatatypeHelper.safeTrimOrNullString(element.getAttributeNS(null, "name"));
    if (attributeName == null) {
        throw new BeanCreationException("SAML 2 attribute encoders must contain a name");
    }
}

From source file:edu.internet2.middleware.shibboleth.common.config.attribute.filtering.match.basic.NotMatchFunctorBeanDefinitionParser.java

/** {@inheritDoc} */
protected void doParse(Element configElement, ParserContext parserContext, BeanDefinitionBuilder builder) {
    super.doParse(configElement, parserContext, builder);

    List<Element> ruleElements = XMLHelper.getChildElementsByTagNameNS(configElement,
            BasicMatchFunctorNamespaceHandler.NAMESPACE, "Rule");

    builder.addConstructorArgValue(//from   w ww. j  a v  a  2 s .co  m
            SpringConfigurationUtils.parseInnerCustomElement(ruleElements.get(0), parserContext));

    ruleElements = XMLHelper.getChildElementsByTagNameNS(configElement,
            BasicMatchFunctorNamespaceHandler.NAMESPACE, "RuleReference");
    if (!ruleElements.isEmpty()) {
        throw new BeanCreationException("RuleReference elements within a NOT rule are not supported");
    }
}

From source file:com.reactive.hzdfs.cluster.HazelcastClusterServiceFactoryBean.java

@PostConstruct
private void setUp() {
    if (StringUtils.isEmpty(entityBasePkg))
        throw new BeanCreationException("'entityBasePkg' not specified in factory bean");

}