Package org.springframework.beans.factory.config

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


      final Collection<String> ignoreBeansList = new HashSet<String>();
      for (ResteasyRegistration registration : registries.values())
      {
         String beanName = registration.getBeanName();
         ignoreBeansList.add(beanName);
         BeanDefinition beanDef = beanFactory.getBeanDefinition(beanName);
         Class beanClass = null;
         try
         {
            beanClass = Thread.currentThread().getContextClassLoader().loadClass(beanDef.getBeanClassName());
            SpringResourceFactory reg = new SpringResourceFactory(beanName, beanFactory, beanClass);
            getRegistry().addResourceFactory(reg, registration.getContext());
         }
         catch (ClassNotFoundException e)
         {
View Full Code Here


      List<SpringResourceFactory> springResourceFactories = new ArrayList<SpringResourceFactory>();
      for (String name : beanFactory.getBeanDefinitionNames())
      {
         if (ignoreList.contains(name)) continue;

         BeanDefinition beanDef = beanFactory.getBeanDefinition(name);
         if (beanDef.getBeanClassName() == null) continue;
         if (beanDef.isAbstract()) continue;

         Class<?> beanClass = null;
         try
         {
            beanClass = Thread.currentThread().getContextClassLoader().loadClass(beanDef.getBeanClassName());
         }
         catch (ClassNotFoundException e)
         {
            throw new RuntimeException(e);
         }
View Full Code Here

      private boolean isSingleton(String beanName)
      {
         boolean isSingleton = false;
         try {
           BeanDefinition beanDef = beanFactory.getBeanDefinition(beanName);
             isSingleton = beanDef.isSingleton();
         } catch (org.springframework.beans.factory.NoSuchBeanDefinitionException nsbde) {
             // cannot distinguish between singleton & prototype
         }
         return isSingleton;
      }
View Full Code Here

        }

        super.doParse(element, ctx, bean);
       
        if (ctx.getRegistry().containsBeanDefinition(bus)) {
            BeanDefinition def = ctx.getRegistry().getBeanDefinition(bus);
            copyProps(bean, def);
            bean.addConstructorArgValue(bus);
        } else if (!"cxf".equals(bus)) {
            bean.getRawBeanDefinition().setBeanClass(SpringBus.class);
            bean.setDestroyMethodName("shutdown");
View Full Code Here

        ConfigurableApplicationContext ctxt = (ConfigurableApplicationContext)beanFactory;

        // Take any bean name or alias that has a web service annotation
        for (int i = 0; i < beanNames.length; i++) {

            BeanDefinition def = ctxt.getBeanFactory().getBeanDefinition(beanNames[i]);

            if (!beanFactory.isSingleton(beanNames[i]) || def.isAbstract()) {
                continue;
            }

            try {
                Collection<?> ids = null;
                PropertyValue pv = def.getPropertyValues().getPropertyValue(idsProperty);
               
                if (pv != null) {
                    Object value = pv.getValue();
                    if (!(value instanceof Collection)) {
                        throw new RuntimeException("The property " + idsProperty + " must be a collection!");
View Full Code Here

        if (first == null) {
            throw new IllegalStateException(propertyName + " property must have child elements!");
        }
       
        String id;
        BeanDefinition child;
        if (first.getNamespaceURI().equals(BeanDefinitionParserDelegate.BEANS_NAMESPACE_URI)) {
            String name = first.getLocalName();
            if ("ref".equals(name)) {
                id = first.getAttribute("bean");
                if (id == null) {
View Full Code Here

        String args = DomUtils.getChildElementValueByTagName(child, "arguments");

        if (args != null) {
          // create linked properties
          BeanDefinition params = BeanDefinitionBuilder.genericBeanDefinition(LinkedProperties.class).addConstructorArgValue(args).getBeanDefinition();
          def.getConstructorArgumentValues().addIndexedArgumentValue(1, params);
        }
        defs.add(def);
      }
View Full Code Here

    }

    Object script = null;
    if (nestedScript != null) {
      // parse the script definition
      BeanDefinition nested = new ScriptParser().parse(nestedScript, parserContext);
      if (StringUtils.hasText(scope)) {
        nested.setScope(scope);
      }
      script = nested;
    }
    else {
      script = new RuntimeBeanReference(attribute);
View Full Code Here

      builder.addPropertyValue("extension", StringUtils.getFilenameExtension(location));
    }

    // parse properties
    BeanDefinition bd = new GenericBeanDefinition();
    parserContext.getDelegate().parsePropertyElements(element, bd);

    ManagedMap<String, Object> args = new ManagedMap<String, Object>();
    List<PropertyValue> list = bd.getPropertyValues().getPropertyValueList();

    for (PropertyValue pv : list) {
      args.put(pv.getName(), pv.getValue());
    }
View Full Code Here

                def.getConstructorArgumentValues().addIndexedArgumentValue(0, resource, Resource.class.getName());
                String args = DomUtils.getChildElementValueByTagName(child, "arguments");

                if (args != null) {
                    BeanDefinition params = BeanDefinitionBuilder.genericBeanDefinition(LinkedProperties.class).addConstructorArgValue(args).getBeanDefinition();
                    def.getConstructorArgumentValues().addIndexedArgumentValue(1, params);
                }
                defs.add(def);

            }
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.