Example usage for org.springframework.beans.factory.xml ParserContext getReaderContext

List of usage examples for org.springframework.beans.factory.xml ParserContext getReaderContext

Introduction

In this page you can find the example usage for org.springframework.beans.factory.xml ParserContext getReaderContext.

Prototype

public final XmlReaderContext getReaderContext() 

Source Link

Usage

From source file:org.springframework.integration.config.xml.ChainParser.java

private void validateChild(Element element, ParserContext parserContext) {

    final Object source = parserContext.extractSource(element);

    final String order = element.getAttribute(IntegrationNamespaceUtils.ORDER);

    if (StringUtils.hasText(order)) {
        parserContext.getReaderContext().error(IntegrationNamespaceUtils.createElementDescription(element)
                + " must not define " + "an 'order' attribute when used within a chain.", source);
    }/*from   ww  w. j  av a 2  s  .  com*/

    final List<Element> pollerChildElements = DomUtils.getChildElementsByTagName(element, "poller");

    if (!pollerChildElements.isEmpty()) {
        parserContext.getReaderContext().error(IntegrationNamespaceUtils.createElementDescription(element)
                + " must not define " + "a 'poller' sub-element when used within a chain.", source);
    }
}

From source file:org.springframework.integration.config.xml.PointToPointChannelParser.java

@Override
protected BeanDefinitionBuilder buildBeanDefinition(Element element, ParserContext parserContext) {
    BeanDefinitionBuilder builder = null;
    Element queueElement = null;/*from  w  ww  .  j  a  v a  2  s.  c om*/

    // configure a queue-based channel if any queue sub-element is defined
    if ((queueElement = DomUtils.getChildElementByTagName(element, "queue")) != null) {
        builder = BeanDefinitionBuilder.genericBeanDefinition(QueueChannel.class);
        boolean hasStoreRef = this.parseStoreRef(builder, queueElement, element.getAttribute(ID_ATTRIBUTE));
        boolean hasQueueRef = this.parseQueueRef(builder, queueElement);
        if (!hasStoreRef) {
            boolean hasCapacity = this.parseQueueCapacity(builder, queueElement);
            if (hasCapacity && hasQueueRef) {
                parserContext.getReaderContext().error("The 'capacity' attribute is not allowed"
                        + " when providing a 'ref' to a custom queue.", element);
            }
        }
        if (hasStoreRef && hasQueueRef) {
            parserContext.getReaderContext().error("The 'message-store' attribute is not allowed"
                    + " when providing a 'ref' to a custom queue.", element);
        }
    } else if ((queueElement = DomUtils.getChildElementByTagName(element, "priority-queue")) != null) {
        builder = BeanDefinitionBuilder.genericBeanDefinition(PriorityChannel.class);
        this.parseQueueCapacity(builder, queueElement);
        String comparatorRef = queueElement.getAttribute("comparator");
        if (StringUtils.hasText(comparatorRef)) {
            builder.addConstructorArgReference(comparatorRef);
        }
    } else if ((queueElement = DomUtils.getChildElementByTagName(element, "rendezvous-queue")) != null) {
        builder = BeanDefinitionBuilder.genericBeanDefinition(RendezvousChannel.class);
    }

    Element dispatcherElement = DomUtils.getChildElementByTagName(element, "dispatcher");

    // check for the dispatcher attribute (deprecated)
    String dispatcherAttribute = element.getAttribute("dispatcher");
    boolean hasDispatcherAttribute = StringUtils.hasText(dispatcherAttribute);
    if (hasDispatcherAttribute && logger.isWarnEnabled()) {
        logger.warn("The 'dispatcher' attribute on the 'channel' element is deprecated. "
                + "Please use the 'dispatcher' sub-element instead.");
    }

    // verify that a dispatcher is not provided if a queue sub-element exists
    if (queueElement != null && (dispatcherElement != null || hasDispatcherAttribute)) {
        parserContext.getReaderContext().error("The 'dispatcher' attribute or sub-element "
                + "and any queue sub-element are mutually exclusive.", element);
        return null;
    }

    if (queueElement != null) {
        return builder;
    }

    if (dispatcherElement != null && hasDispatcherAttribute) {
        parserContext.getReaderContext()
                .error("The 'dispatcher' attribute and 'dispatcher' "
                        + "sub-element are mutually exclusive. NOTE: the attribute is DEPRECATED. "
                        + "Please use the dispatcher sub-element instead.", element);
        return null;
    }

    if (hasDispatcherAttribute) {
        // this attribute is deprecated, but if set, we need to create a DirectChannel
        // without any LoadBalancerStrategy and the failover flag set to true (default).
        builder = BeanDefinitionBuilder.genericBeanDefinition(DirectChannel.class);
        if ("failover".equals(dispatcherAttribute)) {
            // round-robin dispatcher is used by default, the "failover" value simply disables it
            builder.addConstructorArgValue(null);
        }
    } else if (dispatcherElement == null) {
        // configure the default DirectChannel with a RoundRobinLoadBalancingStrategy
        builder = BeanDefinitionBuilder.genericBeanDefinition(DirectChannel.class);
        String maxSubscribers = this.getDefaultMaxSubscribers(parserContext,
                IntegrationNamespaceUtils.DEFAULT_MAX_UNICAST_SUBSCRIBERS_PROPERTY_NAME);
        if (maxSubscribers != null) {
            builder.addPropertyValue("maxSubscribers", maxSubscribers);
        }
    } else {
        // configure either an ExecutorChannel or DirectChannel based on existence of 'task-executor'
        String taskExecutor = dispatcherElement.getAttribute("task-executor");
        if (StringUtils.hasText(taskExecutor)) {
            builder = BeanDefinitionBuilder.genericBeanDefinition(ExecutorChannel.class);
            builder.addConstructorArgReference(taskExecutor);
        } else {
            builder = BeanDefinitionBuilder.genericBeanDefinition(DirectChannel.class);
        }
        // unless the 'load-balancer' attribute is explicitly set to 'none',
        // configure the default RoundRobinLoadBalancingStrategy
        String loadBalancer = dispatcherElement.getAttribute("load-balancer");
        if ("none".equals(loadBalancer)) {
            builder.addConstructorArgValue(null);
        }
        IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, dispatcherElement, "failover");
        this.setMaxSubscribersProperty(parserContext, builder, dispatcherElement,
                IntegrationNamespaceUtils.DEFAULT_MAX_UNICAST_SUBSCRIBERS_PROPERTY_NAME);
    }
    return builder;
}

From source file:org.springframework.integration.jdbc.config.StoredProcParserUtils.java

/**
 * @param storedProcComponent//from   ww  w .j a  va2s  .  c o m
 * @param parserContext
 */
public static ManagedList<BeanDefinition> getSqlParameterDefinitionBeanDefinitions(Element storedProcComponent,
        ParserContext parserContext) {
    List<Element> sqlParameterDefinitionChildElements = DomUtils.getChildElementsByTagName(storedProcComponent,
            "sql-parameter-definition");
    ManagedList<BeanDefinition> sqlParameterList = new ManagedList<BeanDefinition>();

    for (Element childElement : sqlParameterDefinitionChildElements) {

        String name = childElement.getAttribute("name");
        String sqlType = childElement.getAttribute("type");
        String direction = childElement.getAttribute("direction");
        String scale = childElement.getAttribute("scale");
        String typeName = childElement.getAttribute("type-name");
        String returnType = childElement.getAttribute("return-type");

        if (StringUtils.hasText(typeName) && StringUtils.hasText(scale)) {
            parserContext.getReaderContext().error("'type-name' and 'scale' attributes are mutually exclusive "
                    + "for 'sql-parameter-definition' element.", storedProcComponent);
        }

        if (StringUtils.hasText(returnType) && StringUtils.hasText(scale)) {
            parserContext.getReaderContext().error("'returnType' and 'scale' attributes are mutually exclusive "
                    + "for 'sql-parameter-definition' element.", storedProcComponent);
        }

        final BeanDefinitionBuilder parameterBuilder;

        if ("OUT".equalsIgnoreCase(direction)) {
            parameterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SqlOutParameter.class);
        } else if ("INOUT".equalsIgnoreCase(direction)) {
            parameterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SqlInOutParameter.class);
        } else {
            parameterBuilder = BeanDefinitionBuilder.genericBeanDefinition(SqlParameter.class);
            if (StringUtils.hasText(returnType)) {
                parserContext.getReaderContext().error("'return-type' attribute can't be provided "
                        + "for IN 'sql-parameter-definition' element.", storedProcComponent);
            }
        }

        if (StringUtils.hasText(name)) {
            parameterBuilder.addConstructorArgValue(name);
        } else {
            parserContext.getReaderContext().error(
                    "The 'name' attribute must be set for the Sql parameter element.", storedProcComponent);
        }

        if (StringUtils.hasText(sqlType)) {

            JdbcTypesEnum jdbcTypeEnum = JdbcTypesEnum.convertToJdbcTypesEnum(sqlType);

            if (jdbcTypeEnum != null) {
                parameterBuilder.addConstructorArgValue(jdbcTypeEnum.getCode());
            } else {
                parameterBuilder.addConstructorArgValue(sqlType);
            }

        } else {
            parameterBuilder.addConstructorArgValue(Types.VARCHAR);
        }

        if (StringUtils.hasText(typeName)) {
            parameterBuilder.addConstructorArgValue(typeName);
        } else if (StringUtils.hasText(scale)) {
            parameterBuilder.addConstructorArgValue(new TypedStringValue(scale, Integer.class));
        } else {
            parameterBuilder.addConstructorArgValue(null);
        }

        if (StringUtils.hasText(returnType)) {
            parameterBuilder.addConstructorArgReference(returnType);
        }

        sqlParameterList.add(parameterBuilder.getBeanDefinition());
    }
    return sqlParameterList;
}

From source file:org.springframework.integration.jdbc.config.StoredProcParserUtils.java

/**
 * Create a new {@link BeanDefinitionBuilder} for the class {@link StoredProcExecutor}.
 * Initialize the wrapped {@link StoredProcExecutor} with common properties.
 *
 * @param element Must not be Null//ww  w.j  a v  a2  s.com
 * @param parserContext Must not be Null
 * @return The {@link BeanDefinitionBuilder} for the {@link StoredProcExecutor}
 */
public static BeanDefinitionBuilder getStoredProcExecutorBuilder(final Element element,
        final ParserContext parserContext) {

    Assert.notNull(element, "The provided element must not be Null.");
    Assert.notNull(parserContext, "The provided parserContext must not be Null.");

    final String dataSourceRef = element.getAttribute("data-source");

    final BeanDefinitionBuilder storedProcExecutorBuilder = BeanDefinitionBuilder
            .genericBeanDefinition(StoredProcExecutor.class);
    storedProcExecutorBuilder.addConstructorArgReference(dataSourceRef);

    final String storedProcedureName = element.getAttribute("stored-procedure-name");
    final String storedProcedureNameExpression = element.getAttribute("stored-procedure-name-expression");
    boolean hasStoredProcedureName = StringUtils.hasText(storedProcedureName);
    boolean hasStoredProcedureNameExpression = StringUtils.hasText(storedProcedureNameExpression);

    if (!(hasStoredProcedureName ^ hasStoredProcedureNameExpression)) {
        parserContext.getReaderContext().error(
                "Exactly one of 'stored-procedure-name' or 'stored-procedure-name-expression' is required",
                element);
    }

    BeanDefinitionBuilder expressionBuilder;
    if (hasStoredProcedureNameExpression) {
        expressionBuilder = BeanDefinitionBuilder.genericBeanDefinition(ExpressionFactoryBean.class);
        expressionBuilder.addConstructorArgValue(storedProcedureNameExpression);
    } else {
        expressionBuilder = BeanDefinitionBuilder.genericBeanDefinition(LiteralExpression.class);
        expressionBuilder.addConstructorArgValue(storedProcedureName);
    }
    storedProcExecutorBuilder.addPropertyValue("storedProcedureNameExpression",
            expressionBuilder.getBeanDefinition());

    IntegrationNamespaceUtils.setValueIfAttributeDefined(storedProcExecutorBuilder, element,
            "ignore-column-meta-data");
    IntegrationNamespaceUtils.setValueIfAttributeDefined(storedProcExecutorBuilder, element,
            "jdbc-call-operations-cache-size");

    final ManagedList<BeanDefinition> procedureParameterList = StoredProcParserUtils
            .getProcedureParameterBeanDefinitions(element, parserContext);
    final ManagedList<BeanDefinition> sqlParameterDefinitionList = StoredProcParserUtils
            .getSqlParameterDefinitionBeanDefinitions(element, parserContext);

    if (!procedureParameterList.isEmpty()) {
        storedProcExecutorBuilder.addPropertyValue("procedureParameters", procedureParameterList);
    }
    if (!sqlParameterDefinitionList.isEmpty()) {
        storedProcExecutorBuilder.addPropertyValue("sqlParameters", sqlParameterDefinitionList);
    }

    return storedProcExecutorBuilder;

}

From source file:org.springframework.integration.jpa.config.xml.JpaParserUtils.java

/**
 * Create a new {@link BeanDefinitionBuilder} for the class {@link JpaExecutor}.
 * Initialize the wrapped {@link JpaExecutor} with common properties.
 *
 * @param element Must not be null//w  w w. j av  a 2 s  . c  o  m
 * @param parserContext Must not be null
 * @return The BeanDefinitionBuilder for the JpaExecutor
 */
public static BeanDefinitionBuilder getJpaExecutorBuilder(final Element element,
        final ParserContext parserContext) {

    Assert.notNull(element, "The provided element must not be null.");
    Assert.notNull(parserContext, "The provided parserContext must not be null.");

    final Object source = parserContext.extractSource(element);

    final BeanDefinitionBuilder jpaExecutorBuilder = BeanDefinitionBuilder
            .genericBeanDefinition(JpaExecutor.class);

    int attributeCount = 0;

    final String entityManagerRef = element.getAttribute("entity-manager");
    final String entityManagerFactoryRef = element.getAttribute("entity-manager-factory");
    final String jpaOperationsRef = element.getAttribute("jpa-operations");

    if (StringUtils.hasText(jpaOperationsRef)) {
        attributeCount++;
        jpaExecutorBuilder.addConstructorArgReference(jpaOperationsRef);
    }

    if (StringUtils.hasText(entityManagerRef)) {

        if (attributeCount > 0) {
            parserContext.getReaderContext().error("Exactly only one of the attributes 'entity-manager' or "
                    + "'entity-manager-factory' or 'jpa-operations' must be be set.", source);
        }

        attributeCount++;
        jpaExecutorBuilder.addConstructorArgReference(entityManagerRef);
    }

    if (StringUtils.hasText(entityManagerFactoryRef)) {

        if (attributeCount > 0) {
            parserContext.getReaderContext().error("Exactly only one of the attributes 'entity-manager' or "
                    + "'entity-manager-factory' or 'jpa-operations' must be be set.", source);
        }

        attributeCount++;
        jpaExecutorBuilder.addConstructorArgReference(entityManagerFactoryRef);
    }

    if (attributeCount == 0) {
        parserContext.getReaderContext().error("Exactly one of the attributes 'entity-manager' or "
                + "'entity-manager-factory' or 'jpa-operations' must be be set.", source);
    }

    final ManagedList<BeanDefinition> jpaParameterList = JpaParserUtils.getJpaParameterBeanDefinitions(element,
            parserContext);

    if (!jpaParameterList.isEmpty()) {
        jpaExecutorBuilder.addPropertyValue("jpaParameters", jpaParameterList);
    }

    IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, element, "entity-class");
    IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, element, "jpa-query");
    IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, element, "native-query");
    IntegrationNamespaceUtils.setValueIfAttributeDefined(jpaExecutorBuilder, element, "named-query");

    return jpaExecutorBuilder;

}

From source file:org.springframework.security.config.http.AuthenticationConfigBuilder.java

private BeanMetadataElement createAccessDeniedHandler(Element element, ParserContext pc) {
    Element accessDeniedElt = DomUtils.getChildElementByTagName(element, Elements.ACCESS_DENIED_HANDLER);
    BeanDefinitionBuilder accessDeniedHandler = BeanDefinitionBuilder
            .rootBeanDefinition(AccessDeniedHandlerImpl.class);

    if (accessDeniedElt != null) {
        String errorPage = accessDeniedElt.getAttribute("error-page");
        String ref = accessDeniedElt.getAttribute("ref");

        if (StringUtils.hasText(errorPage)) {
            if (StringUtils.hasText(ref)) {
                pc.getReaderContext()
                        .error("The attribute " + ATT_ACCESS_DENIED_ERROR_PAGE
                                + " cannot be used together with the 'ref' attribute within <"
                                + Elements.ACCESS_DENIED_HANDLER + ">", pc.extractSource(accessDeniedElt));

            }//from   w w w .  j a  v  a 2s .  c om
            accessDeniedHandler.addPropertyValue("errorPage", errorPage);
        } else if (StringUtils.hasText(ref)) {
            return new RuntimeBeanReference(ref);
        }

    }

    return accessDeniedHandler.getBeanDefinition();
}

From source file:org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser.java

public BeanDefinition parse(Element element, ParserContext parserContext) {
    List<Element> interceptUrls = DomUtils.getChildElementsByTagName(element, Elements.INTERCEPT_URL);

    // Check for attributes that aren't allowed in this context
    for (Element elt : interceptUrls) {
        if (StringUtils.hasLength(elt.getAttribute(HttpSecurityBeanDefinitionParser.ATT_REQUIRES_CHANNEL))) {
            parserContext.getReaderContext().error("The attribute '"
                    + HttpSecurityBeanDefinitionParser.ATT_REQUIRES_CHANNEL + "' isn't allowed here.", elt);
        }//from   w ww .j  a v  a  2  s  .co  m

        if (StringUtils.hasLength(elt.getAttribute(HttpSecurityBeanDefinitionParser.ATT_FILTERS))) {
            parserContext.getReaderContext().error(
                    "The attribute '" + HttpSecurityBeanDefinitionParser.ATT_FILTERS + "' isn't allowed here.",
                    elt);
        }

        if (StringUtils.hasLength(elt.getAttribute(ATT_SERVLET_PATH))) {
            parserContext.getReaderContext()
                    .error("The attribute '" + ATT_SERVLET_PATH + "' isn't allowed here.", elt);
        }
    }

    BeanDefinition mds = createSecurityMetadataSource(interceptUrls, false, element, parserContext);

    String id = element.getAttribute(AbstractBeanDefinitionParser.ID_ATTRIBUTE);

    if (StringUtils.hasText(id)) {
        parserContext.registerComponent(new BeanComponentDefinition(mds, id));
        parserContext.getRegistry().registerBeanDefinition(id, mds);
    }

    return mds;
}

From source file:org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser.java

static String registerDefaultExpressionHandler(ParserContext pc) {
    BeanDefinition expressionHandler = GrantedAuthorityDefaultsParserUtils.registerWithDefaultRolePrefix(pc,
            DefaultWebSecurityExpressionHandlerBeanFactory.class);
    String expressionHandlerRef = pc.getReaderContext().generateBeanName(expressionHandler);
    pc.registerBeanComponent(new BeanComponentDefinition(expressionHandler, expressionHandlerRef));

    return expressionHandlerRef;
}

From source file:org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser.java

private static ManagedMap<BeanMetadataElement, BeanDefinition> parseInterceptUrlsForFilterInvocationRequestMap(
        MatcherType matcherType, List<Element> urlElts, boolean useExpressions, boolean addAuthenticatedAll,
        ParserContext parserContext) {

    ManagedMap<BeanMetadataElement, BeanDefinition> filterInvocationDefinitionMap = new ManagedMap<>();

    for (Element urlElt : urlElts) {
        String access = urlElt.getAttribute(ATT_ACCESS);
        if (!StringUtils.hasText(access)) {
            continue;
        }//from  w  ww . java  2 s  .c  o  m

        String path = urlElt.getAttribute(ATT_PATTERN);
        String matcherRef = urlElt.getAttribute(ATT_REQUEST_MATCHER_REF);
        boolean hasMatcherRef = StringUtils.hasText(matcherRef);

        if (!hasMatcherRef && !StringUtils.hasText(path)) {
            parserContext.getReaderContext().error("path attribute cannot be empty or null", urlElt);
        }

        String method = urlElt.getAttribute(ATT_HTTP_METHOD);
        if (!StringUtils.hasText(method)) {
            method = null;
        }

        String servletPath = urlElt.getAttribute(ATT_SERVLET_PATH);
        if (!StringUtils.hasText(servletPath)) {
            servletPath = null;
        } else if (!MatcherType.mvc.equals(matcherType)) {
            parserContext.getReaderContext().error(
                    ATT_SERVLET_PATH + " is not applicable for request-matcher: '" + matcherType.name() + "'",
                    urlElt);
        }

        BeanMetadataElement matcher = hasMatcherRef ? new RuntimeBeanReference(matcherRef)
                : matcherType.createMatcher(parserContext, path, method, servletPath);
        BeanDefinitionBuilder attributeBuilder = BeanDefinitionBuilder.rootBeanDefinition(SecurityConfig.class);

        if (useExpressions) {
            logger.info("Creating access control expression attribute '" + access + "' for " + path);
            // The single expression will be parsed later by the
            // ExpressionBasedFilterInvocationSecurityMetadataSource
            attributeBuilder.addConstructorArgValue(new String[] { access });
            attributeBuilder.setFactoryMethod("createList");

        } else {
            attributeBuilder.addConstructorArgValue(access);
            attributeBuilder.setFactoryMethod("createListFromCommaDelimitedString");
        }

        if (filterInvocationDefinitionMap.containsKey(matcher)) {
            logger.warn(
                    "Duplicate URL defined: " + path + ". The original attribute values will be overwritten");
        }

        filterInvocationDefinitionMap.put(matcher, attributeBuilder.getBeanDefinition());
    }

    if (addAuthenticatedAll && filterInvocationDefinitionMap.isEmpty()) {

        BeanDefinition matcher = matcherType.createMatcher(parserContext, "/**", null);
        BeanDefinitionBuilder attributeBuilder = BeanDefinitionBuilder.rootBeanDefinition(SecurityConfig.class);
        attributeBuilder.addConstructorArgValue(new String[] { "authenticated" });
        attributeBuilder.setFactoryMethod("createList");
        filterInvocationDefinitionMap.put(matcher, attributeBuilder.getBeanDefinition());
    }

    return filterInvocationDefinitionMap;
}

From source file:org.springframework.security.config.http.HttpSecurityBeanDefinitionParser.java

/**
 * Creates the {@code SecurityFilterChain} bean from an &lt;http&gt; element.
 *//* w w w  . java 2 s .  c o  m*/
private BeanReference createFilterChain(Element element, ParserContext pc) {
    boolean secured = !OPT_SECURITY_NONE.equals(element.getAttribute(ATT_SECURED));

    if (!secured) {
        if (!StringUtils.hasText(element.getAttribute(ATT_PATH_PATTERN))
                && !StringUtils.hasText(ATT_REQUEST_MATCHER_REF)) {
            pc.getReaderContext()
                    .error("The '" + ATT_SECURED + "' attribute must be used in combination with" + " the '"
                            + ATT_PATH_PATTERN + "' or '" + ATT_REQUEST_MATCHER_REF + "' attributes.",
                            pc.extractSource(element));
        }

        for (int n = 0; n < element.getChildNodes().getLength(); n++) {
            if (element.getChildNodes().item(n) instanceof Element) {
                pc.getReaderContext().error("If you are using <http> to define an unsecured pattern, "
                        + "it cannot contain child elements.", pc.extractSource(element));
            }
        }

        return createSecurityFilterChainBean(element, pc, Collections.emptyList());
    }

    final BeanReference portMapper = createPortMapper(element, pc);
    final BeanReference portResolver = createPortResolver(portMapper, pc);

    ManagedList<BeanReference> authenticationProviders = new ManagedList<>();
    BeanReference authenticationManager = createAuthenticationManager(element, pc, authenticationProviders);

    boolean forceAutoConfig = isDefaultHttpConfig(element);
    HttpConfigurationBuilder httpBldr = new HttpConfigurationBuilder(element, forceAutoConfig, pc, portMapper,
            portResolver, authenticationManager);

    AuthenticationConfigBuilder authBldr = new AuthenticationConfigBuilder(element, forceAutoConfig, pc,
            httpBldr.getSessionCreationPolicy(), httpBldr.getRequestCache(), authenticationManager,
            httpBldr.getSessionStrategy(), portMapper, portResolver, httpBldr.getCsrfLogoutHandler());

    httpBldr.setLogoutHandlers(authBldr.getLogoutHandlers());
    httpBldr.setEntryPoint(authBldr.getEntryPointBean());
    httpBldr.setAccessDeniedHandler(authBldr.getAccessDeniedHandlerBean());

    authenticationProviders.addAll(authBldr.getProviders());

    List<OrderDecorator> unorderedFilterChain = new ArrayList<>();

    unorderedFilterChain.addAll(httpBldr.getFilters());
    unorderedFilterChain.addAll(authBldr.getFilters());
    unorderedFilterChain.addAll(buildCustomFilterList(element, pc));

    Collections.sort(unorderedFilterChain, new OrderComparator());
    checkFilterChainOrder(unorderedFilterChain, pc, pc.extractSource(element));

    // The list of filter beans
    List<BeanMetadataElement> filterChain = new ManagedList<>();

    for (OrderDecorator od : unorderedFilterChain) {
        filterChain.add(od.bean);
    }

    return createSecurityFilterChainBean(element, pc, filterChain);
}