Package org.springframework.beans.factory.config

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


    GenericBeanDefinition bd = new GenericBeanDefinition();
    bd.setBeanClassName("org.jibeframework.core.util.ViewComponentFactory");
    bd.setScope(scope);
    bd.setAutowireMode(GenericBeanDefinition.AUTOWIRE_NO);
    bd.setDependencyCheck(AbstractBeanDefinition.DEPENDENCY_CHECK_NONE);
    ConstructorArgumentValues cav = bd.getConstructorArgumentValues();
    cav.addIndexedArgumentValue(0, file);
    BeanDefinitionHolder holder = new BeanDefinitionHolder(bd, beanName, new String[] {});
    BeanDefinitionReaderUtils.registerBeanDefinition(holder, fact);

  }
View Full Code Here


                    .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

                    bd.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR);
                }
            }
            // constructorArgs
            else if(CONSTRUCTOR_ARGS.equals(property) && newValue instanceof List) {
                ConstructorArgumentValues cav = new ConstructorArgumentValues();
                List args = (List)newValue;
                for (Object e : args) {
                    cav.addGenericArgumentValue(e);
                }
                bd.setConstructorArgumentValues(cav);
            }
            // destroyMethod
            else if(DESTROY_METHOD.equals(property)) {
View Full Code Here

  }

  protected AbstractBeanDefinition createBeanDefinition() {
    AbstractBeanDefinition bd;
    if(constructorArgs.size() > 0) {
      ConstructorArgumentValues cav = new ConstructorArgumentValues();
            for (Object constructorArg : constructorArgs) {
                cav.addGenericArgumentValue(constructorArg);
            }
            if(StringUtils.isBlank(parentName)) {
                bd = new RootBeanDefinition(clazz,cav,null);
            }
            else {
View Full Code Here

  private GenericApplicationContext setupSqlSessionTemplate() {

    GenericApplicationContext genericApplicationContext = setupSqlSessionFactory();
    GenericBeanDefinition definition = new GenericBeanDefinition();
    definition.setBeanClass(SqlSessionTemplate.class);
    ConstructorArgumentValues constructorArgs = new ConstructorArgumentValues();
    constructorArgs.addGenericArgumentValue(new RuntimeBeanReference("sqlSessionFactory"));
    definition.setConstructorArgumentValues(constructorArgs);
    genericApplicationContext.registerBeanDefinition("sqlSessionTemplate", definition);
    return genericApplicationContext;
  }
View Full Code Here

    private String getLoginFormUrl(BeanDefinition entryPoint) {
        if (entryPoint == null) {
            return null;
        }

        ConstructorArgumentValues cavs = entryPoint.getConstructorArgumentValues();
        ValueHolder vh = cavs.getIndexedArgumentValue(0, String.class);
        if (vh == null) {
             return null;
        }

        // If the login URL is the default one, then it is assumed not to have been set explicitly
View Full Code Here

  @Test
  public void testScanWithExplicitSqlSessionTemplate() throws Exception {
    GenericBeanDefinition definition = new GenericBeanDefinition();
    definition.setBeanClass(SqlSessionTemplate.class);
    ConstructorArgumentValues constructorArgs = new ConstructorArgumentValues();
    constructorArgs.addGenericArgumentValue(new RuntimeBeanReference("sqlSessionFactory"));
    definition.setConstructorArgumentValues(constructorArgs);
    applicationContext.registerBeanDefinition("sqlSessionTemplate", definition);

    applicationContext.getBeanDefinition("mapperScanner").getPropertyValues().add(
        "sqlSessionTemplateBeanName", "sqlSessionTemplate");
View Full Code Here

  @Test
  public void testScanWithExplicitSqlSessionTemplate() throws Exception {
    GenericBeanDefinition definition = new GenericBeanDefinition();
    definition.setBeanClass(SqlSessionTemplate.class);
    ConstructorArgumentValues constructorArgs = new ConstructorArgumentValues();
    constructorArgs.addGenericArgumentValue(new RuntimeBeanReference("sqlSessionFactory"));
    definition.setConstructorArgumentValues(constructorArgs);
    applicationContext.registerBeanDefinition("sqlSessionTemplate", definition);

    applicationContext.register(AppConfigWithSqlSessionTemplate.class);
   
View Full Code Here

    else if (beanDefinitionDefaults.getDestroyMethodName() != null)
    {
      beanDef.setDestroyMethodName(beanDefinitionDefaults.getDestroyMethodName());
    }
   
    ConstructorArgumentValues constructorArgs = beanDef.getConstructorArgumentValues();
   
    String scriptSource = element.getAttribute(SCRIPT_SOURCE_ATTRIBUTE);
   
    //have to do this here, as otherwise the Script post processor will take over
    if(!element.hasAttribute(SCRIPT_SOURCE_RELATIVE_ATTRIBUTE) || element.getAttribute(SCRIPT_SOURCE_RELATIVE_ATTRIBUTE).equals("true"))
    {
      //strip off the file://
      scriptSource = scriptSource.substring(7);
     
      scriptSource = Utils.expandPath(scriptSource, FusionContext.getCurrent().pageContext);
     
      scriptSource = "file://" + scriptSource;
    }
   
    String[] interfaces = element.getAttribute(SCRIPT_INTERFACES_ATTRIBUTE).split(",");
   
    constructorArgs.addIndexedArgumentValue(0, scriptSource);
    constructorArgs.addIndexedArgumentValue(1, interfaces);

    // Add any property definitions that need adding.
    parserContext.getDelegate().parsePropertyElements(element, beanDef);
   
    return beanDef;
View Full Code Here

    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
    lbf.setTypeConverter(new CustomTypeConverter(nf));
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("myFloat", "1,1");
    ConstructorArgumentValues cav = new ConstructorArgumentValues();
    cav.addIndexedArgumentValue(0, "myName");
    cav.addIndexedArgumentValue(1, "myAge");
    lbf.registerBeanDefinition("testBean", new RootBeanDefinition(TestBean.class, cav, pvs));
    TestBean testBean = (TestBean) lbf.getBean("testBean");
    assertEquals("myName", testBean.getName());
    assertEquals(5, testBean.getAge());
    assertTrue(testBean.getMyFloat().floatValue() == 1.1f);
View Full Code Here

TOP

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

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.