Package org.springframework.beans.factory.config

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


            }
            node = node.getNextSibling();
        }
       
        String id = getIdOrName(element);
        BeanDefinition container = ctx.getContainingBeanDefinition();
        boolean noFactory = false;
        if (StringUtils.isEmpty(id)) {
            if (container == null) {
                id = BeanDefinitionReaderUtils.generateBeanName(bean.getBeanDefinition(),
                                                                ctx.getRegistry(),
View Full Code Here


        if (factory.containsBeanDefinition(Bus.DEFAULT_BUS_ID)) {
            inject = new RuntimeBeanReference(Bus.DEFAULT_BUS_ID);
        }
        for (String beanName : factory.getBeanDefinitionNames()) {
            LOG.fine("Checking bean " + beanName);
            BeanDefinition beanDefinition = factory.getBeanDefinition(beanName);
            if (BusWiringType.PROPERTY == beanDefinition
                .getAttribute(AbstractBeanDefinitionParser.WIRE_BUS_ATTRIBUTE)) {
                LOG.fine("Found " + AbstractBeanDefinitionParser.WIRE_BUS_ATTRIBUTE + " attribute "
                         + BusWiringType.PROPERTY + " on bean " + beanName);
                beanDefinition.getPropertyValues()
                    .addPropertyValue("bus", inject);
            } else if (BusWiringType.CONSTRUCTOR == beanDefinition
                .getAttribute(AbstractBeanDefinitionParser.WIRE_BUS_ATTRIBUTE)) {
                LOG.fine("Found " + AbstractBeanDefinitionParser.WIRE_BUS_ATTRIBUTE + " attribute "
                         + BusWiringType.CONSTRUCTOR + " on bean " + beanName);
                ConstructorArgumentValues constructorArgs = beanDefinition.getConstructorArgumentValues();
                insertConstructorArg(constructorArgs, inject);
            }
        }
    }
View Full Code Here

            for (ApplicationContext appContext : appContexts) {
                for (String n : appContext.getBeanDefinitionNames()) {
                    if (isWildcardBeanName(n)) {
                        AutowireCapableBeanFactory bf = appContext.getAutowireCapableBeanFactory();
                        BeanDefinitionRegistry bdr = (BeanDefinitionRegistry) bf;
                        BeanDefinition bd = bdr.getBeanDefinition(n);
                        String className = bd.getBeanClassName();
                        if (null != className) {
                            String orig = n;
                            if (n.charAt(0) == '*') {
                                //old wildcard
                                n = "." + n.replaceAll("\\.", "\\.");
View Full Code Here

        // find any kagent's for the current kbase and assign (only if this
        // is a stateless session)
        if (sessionType.equals("stateless")) {
            for (String beanName : parserContext.getRegistry().getBeanDefinitionNames()) {
                BeanDefinition def = parserContext.getRegistry().getBeanDefinition(beanName);
                if (KnowledgeAgentBeanFactory.class.getName().equals(def.getBeanClassName())) {
                    PropertyValue pvalue = def.getPropertyValues().getPropertyValue("kbase");
                    RuntimeBeanReference tbf = (RuntimeBeanReference) pvalue.getValue();
                    if (kbase.equals(tbf.getBeanName())) {
                        factory.addPropertyValue("knowledgeAgent",
                                new RuntimeBeanReference(beanName));
                    }
View Full Code Here

        if (beanName != null)
        {
            modelBean = (ModelBean)modelBeanMap.get(beanName);
            if (modelBean == null)
            {
                BeanDefinition bd = springFactory.getBeanDefinition(beanName);
                Object bean = springFactory.getBean(beanName);
                if (bd == null || bean == null)
                {
                    return new ModelBeanImpl(beanName, ModelBean.POJO);
                }                  
                String lookup = null;
                boolean requiresExternalSupport = false;
                PropertyValue value = bd.getPropertyValues().getPropertyValue("lookupKey");
                if (value != null)
                {
                    lookup = (String)value.getValue();
                }               
                if (bean instanceof ExternalComponentSupport)
View Full Code Here

    }

    protected void createBeanPostProcessor(ParserContext parserContext, String contextId, Element childElement, BeanDefinitionBuilder parentBuilder) {
        String beanPostProcessorId = contextId + ":beanPostProcessor";
        childElement.setAttribute("id", beanPostProcessorId);
        BeanDefinition definition = beanPostProcessorParser.parse(childElement, parserContext);
        definition.getPropertyValues().addPropertyValue("camelContext", new RuntimeBeanReference(contextId));
        parentBuilder.addPropertyReference("beanPostProcessor", beanPostProcessorId);
    }
View Full Code Here

                    String localName = child.getLocalName();
                    if (localName.equals("beanPostProcessor")) {
                        createBeanPostProcessor(parserContext, contextId, childElement, builder);
                        createdBeanPostProcessor = true;
                    } else if (localName.equals("endpoint")) {
                        BeanDefinition definition = endpointParser.parse(childElement, parserContext);
                        String id = childElement.getAttribute("id");
                        if (ObjectHelper.isNotNullAndNonEmpty(id)) {
                            // TODO we can zap this?
                            definition.getPropertyValues()
                                .addPropertyValue("camelContext", new RuntimeBeanReference(contextId));
                            // definition.getPropertyValues().addPropertyValue("context",
                            // builder.getBeanDefinition());
                            parserContext.registerComponent(new BeanComponentDefinition(definition, id));
                        }
                    } else {
                        BeanDefinitionParser parser = parserMap.get(localName);
                        if (parser != null) {
                            BeanDefinition definition = parser.parse(childElement, parserContext);
                            String id = childElement.getAttribute("id");
                            if (ObjectHelper.isNotNullAndNonEmpty(id)) {
                                parserContext.registerComponent(new BeanComponentDefinition(definition, id));
                                if (localName.equals("jmxAgent")) {
                                    builder.addPropertyReference("camelJMXAgent", id);
View Full Code Here

            Node n = children.item(i);
            if (n.getNodeType() == Node.ELEMENT_NODE) {
                String name = n.getLocalName();
                if ("camelContext".equals(name)) {
                    // Parser the camel context
                    BeanDefinition bd = ctx.getDelegate().parseCustomElement((Element)n);
                    // Get the inner camel context id
                    String contextId = (String)bd.getPropertyValues().getPropertyValue("id").getValue();
                    wireCamelContext(bean, getContextId(contextId));
                } else if ("camelContextRef".equals(name)) {
                    String contextId = n.getTextContent();
                    wireCamelContext(bean, getContextId(contextId));
                }
View Full Code Here

    {
      Iterator<String> it = names.iterator();
      while (it.hasNext())
      {
        final String possibility = it.next();
        BeanDefinition beanDef = getBeanDefinition(
          ((AbstractApplicationContext)ctx).getBeanFactory(), possibility);
        if (BeanFactoryUtils.isFactoryDereference(possibility) ||
          possibility.startsWith("scopedTarget.") ||
          (beanDef != null && !beanDef.isAutowireCandidate()))
        {
          it.remove();
        }
      }
    }

    if (names.isEmpty())
    {
      if (required)
      {
        throw new IllegalStateException("bean of type [" + clazz.getName() + "] not found");
      }
      return null;
    }
    else if (names.size() > 1)
    {
      if (ctx instanceof AbstractApplicationContext)
      {
        List<String> primaries = new ArrayList<>();
        for (String name : names)
        {
          BeanDefinition beanDef = getBeanDefinition(
            ((AbstractApplicationContext)ctx).getBeanFactory(), name);
          if (beanDef instanceof AbstractBeanDefinition)
          {
            if (beanDef.isPrimary())
            {
              primaries.add(name);
            }
          }
        }
View Full Code Here

                    } else if (localName.equals("routeBuilder")) {
                        addDependsOnToRouteBuilder(childElement, parserContext, contextId);
                    } else {
                        BeanDefinitionParser parser = parserMap.get(localName);
                        if (parser != null) {
                            BeanDefinition definition = parser.parse(childElement, parserContext);
                            String id = childElement.getAttribute("id");
                            if (ObjectHelper.isNotEmpty(id)) {
                                parserContext.registerComponent(new BeanComponentDefinition(definition, id));
                                // set the templates with the camel context
                                if (localName.equals("template") || localName.equals("consumerTemplate")
                                        || localName.equals("proxy") || localName.equals("export")) {
                                    // set the camel context
                                    definition.getPropertyValues().addPropertyValue("camelContext", new RuntimeBeanReference(contextId));
                                }
                            }
                        }
                    }
                }
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.