Examples of BeanDefinition


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

    beanReferenceParserControl.replay();

    // method to test.
    parser.parseCacheSetupStrategy(proxyElement, parserContext, propertySource);

    BeanDefinition proxyDefinition = registry
        .getBeanDefinition(proxyElementBuilder.id);

    // verify property "target" is correct.
    PropertyValue target = proxyDefinition.getPropertyValues()
        .getPropertyValue("target");
    assertEquals(holder, target.getValue());
    assertCacheProxyFactoryBeanDefinitionIsCorrect(proxyDefinition);

    beanReferenceParserControl.verify();
View Full Code Here

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

    {
      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<String>();
        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

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

        return false;
    }

    public boolean hasConfiguredPropertyValue(String beanName, String propertyName, String searchValue) {
        ConfigurableApplicationContext ctxt = (ConfigurableApplicationContext)context;
        BeanDefinition def = ctxt.getBeanFactory().getBeanDefinition(beanName);
        if (!ctxt.getBeanFactory().isSingleton(beanName) || def.isAbstract()) {
            return false;
        }
        Collection<?> ids = null;
        PropertyValue pv = def.getPropertyValues().getPropertyValue(propertyName);
       
        if (pv != null) {
            Object value = pv.getValue();
            if (!(value instanceof Collection)) {
                throw new RuntimeException("The property " + propertyName + " must be a collection!");
View Full Code Here

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

        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

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

    {
      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<String>();
        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

Examples of us.codecraft.tinyioc.beans.BeanDefinition

  }

  protected void processBeanDefinition(Element ele) {
    String name = ele.getAttribute("id");
    String className = ele.getAttribute("class");
    BeanDefinition beanDefinition = new BeanDefinition();
    processProperty(ele, beanDefinition);
    beanDefinition.setBeanClassName(className);
    getRegistry().put(name, beanDefinition);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.