Package org.springframework.beans.factory.config

Examples of org.springframework.beans.factory.config.BeanDefinition


            applicationContext.registerBeanDefinition(bc.getName(),
                    bc.getBeanDefinition());
        }
        for (String key : beanDefinitions.keySet()) {
            BeanDefinition bd = beanDefinitions.get(key);
            if (LOGGER.isLoggable(Level.FINER)) {
                LOGGER.finer("[RuntimeConfiguration] Registering bean [" + key + "]");
                if (LOGGER.isLoggable(Level.FINEST)) {
                    for (PropertyValue pv : bd.getPropertyValues().getPropertyValues()) {
                        LOGGER.finest("[RuntimeConfiguration] With property [" + pv.getName() + "] set to [" + pv.getValue() + "]");
                    }
                }
            }
            if (applicationContext.containsBean(key)) {
View Full Code Here


        when(element.getAttribute("message")).thenReturn(A_MESSAGE);
        when(element.getAttribute("expected-ref")).thenReturn(NON_EXPRESSION);
        when(element.getAttribute("value-ref")).thenReturn(EXPRESSION);

        BeanDefinition beanDefinition = parser.parse(element, null);

        MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();

        assertNotNull(beanDefinition);
        assertEquals(AssertOnEqualsMessageProcessor.class.getName(), beanDefinition.getBeanClassName());
        assertEquals(A_MESSAGE, propertyValues.getPropertyValue("message").getValue());
        assertEquals(EXPRESSION, propertyValues.getPropertyValue("value").getValue());
        assertTrue(propertyValues.getPropertyValue("expected").getValue() instanceof RuntimeBeanReference);

    }
View Full Code Here

        public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
            if(!registry.containsBeanDefinition(beanName)) {
                return;
            }
            BeanDefinition beanDefinition = registry.getBeanDefinition(beanName);
            beanDefinition.setLazyInit(true);
        }
View Full Code Here

            }

            mappings.put(methodName, attributeBuilder.getBeanDefinition());
        }

        BeanDefinition metadataSource = new RootBeanDefinition(MapBasedMethodSecurityMetadataSource.class);
        metadataSource.getConstructorArgumentValues().addGenericArgumentValue(mappings);
        interceptor.addPropertyValue("securityMetadataSource", metadataSource);

        return interceptor.getBeanDefinition();
    }
View Full Code Here

*/
public class FilterChainMapBeanDefinitionDecorator implements BeanDefinitionDecorator {

    @SuppressWarnings("unchecked")
    public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder holder, ParserContext parserContext) {
        BeanDefinition filterChainProxy = holder.getBeanDefinition();

        Map filterChainMap = new LinkedHashMap();
        Element elt = (Element)node;

        MatcherType matcherType = MatcherType.fromElement(elt);

        List<Element> filterChainElts = DomUtils.getChildElementsByTagName(elt, Elements.FILTER_CHAIN);

        for (Element chain : filterChainElts) {
            String path = chain.getAttribute(HttpSecurityBeanDefinitionParser.ATT_PATH_PATTERN);
            String filters = chain.getAttribute(HttpSecurityBeanDefinitionParser.ATT_FILTERS);

            if(!StringUtils.hasText(path)) {
                parserContext.getReaderContext().error("The attribute '" + HttpSecurityBeanDefinitionParser.ATT_PATH_PATTERN +
                    "' must not be empty", elt);
            }

            if(!StringUtils.hasText(filters)) {
                parserContext.getReaderContext().error("The attribute '" + HttpSecurityBeanDefinitionParser.ATT_FILTERS +
                    "'must not be empty", elt);
            }

            BeanDefinition matcher = matcherType.createMatcher(path, null);

            if (filters.equals(HttpSecurityBeanDefinitionParser.OPT_FILTERS_NONE)) {
                filterChainMap.put(matcher, Collections.EMPTY_LIST);
            } else {
                String[] filterBeanNames = StringUtils.tokenizeToStringArray(filters, ",");
View Full Code Here

            pc.getReaderContext().error("ref attribute is required", pc.extractSource(element));
        }

        // Ensure the FCP is registered.
        HttpSecurityBeanDefinitionParser.registerFilterChainProxyIfNecessary(pc, pc.extractSource(element));
        BeanDefinition filterChainProxy = pc.getRegistry().getBeanDefinition(BeanIds.FILTER_CHAIN_PROXY);
        filterChainProxy.getPropertyValues().addPropertyValue("firewall", new RuntimeBeanReference(ref));

        return null;
    }
View Full Code Here

        pc.pushContainingComponent(compositeDef);

        registerFilterChainProxyIfNecessary(pc, pc.extractSource(element));

        // Obtain the filter chains and add the new chain to it
        BeanDefinition listFactoryBean = pc.getRegistry().getBeanDefinition(BeanIds.FILTER_CHAINS);
        List<BeanReference> filterChains = (List<BeanReference>)
                listFactoryBean.getPropertyValues().getPropertyValue("sourceList").getValue();

        filterChains.add(createFilterChain(element, pc));

        pc.popAndRegisterContainingComponent();
        return null;
View Full Code Here

        BeanDefinitionBuilder filterChainBldr = BeanDefinitionBuilder.rootBeanDefinition(DefaultSecurityFilterChain.class);
        filterChainBldr.addConstructorArgValue(filterChainMatcher);
        filterChainBldr.addConstructorArgValue(filterChain);

        BeanDefinition filterChainBean = filterChainBldr.getBeanDefinition();

        String id = element.getAttribute("name");
        if (!StringUtils.hasText(id)) {
            id = element.getAttribute("id");
            if (!StringUtils.hasText(id)) {
View Full Code Here

        return new RuntimeBeanReference(id);
    }

    private BeanReference createPortMapper(Element elt, ParserContext pc) {
        // Register the portMapper. A default will always be created, even if no element exists.
        BeanDefinition portMapper = new PortMappingsBeanDefinitionParser().parse(
                DomUtils.getChildElementByTagName(elt, Elements.PORT_MAPPINGS), pc);
        String portMapperName = pc.getReaderContext().generateBeanName(portMapper);
        pc.registerBeanComponent(new BeanComponentDefinition(portMapper, portMapperName));

        return new RuntimeBeanReference(portMapperName);
View Full Code Here

            authManager.addConstructorArgValue(new RuntimeBeanReference(amfbId));
            authManager.addPropertyValue("eraseCredentialsAfterAuthentication", clearCredentials);
        }

        authManager.getRawBeanDefinition().setSource(pc.extractSource(element));
        BeanDefinition authMgrBean = authManager.getBeanDefinition();
        String id = pc.getReaderContext().generateBeanName(authMgrBean);
        pc.registerBeanComponent(new BeanComponentDefinition(authMgrBean, id));

        return new RuntimeBeanReference(id);
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.config.BeanDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.