Examples of addGenericArgumentValue()


Examples of org.springframework.beans.factory.config.ConstructorArgumentValues.addGenericArgumentValue()

            // 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

Examples of org.springframework.beans.factory.config.ConstructorArgumentValues.addGenericArgumentValue()

  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

Examples of org.springframework.beans.factory.config.ConstructorArgumentValues.addGenericArgumentValue()

    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

Examples of org.springframework.beans.factory.config.ConstructorArgumentValues.addGenericArgumentValue()

  @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

Examples of org.springframework.beans.factory.config.ConstructorArgumentValues.addGenericArgumentValue()

  @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

Examples of org.springframework.beans.factory.config.ConstructorArgumentValues.addGenericArgumentValue()

    RootBeanDefinition factoryMethodDefinitionWithArgs = new RootBeanDefinition();
    factoryMethodDefinitionWithArgs.setFactoryBeanName("factoryBeanInstance");
    factoryMethodDefinitionWithArgs.setFactoryMethodName("createWithArgs");
    ConstructorArgumentValues cvals = new ConstructorArgumentValues();
    cvals.addGenericArgumentValue(expectedNameFromArgs);
    factoryMethodDefinitionWithArgs.setConstructorArgumentValues(cvals);
    if (!singleton) {
      factoryMethodDefinitionWithArgs.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
    }
    lbf.registerBeanDefinition("fmWithArgs", factoryMethodDefinitionWithArgs);
View Full Code Here

Examples of org.springframework.beans.factory.config.ConstructorArgumentValues.addGenericArgumentValue()

      if (argName.startsWith(DELIMITER_PREFIX)) {
        String arg = argName.substring(1).trim();

        // fast default check
        if (!StringUtils.hasText(arg)) {
          cvs.addGenericArgumentValue(valueHolder);
        }
        // assume an index otherwise
        else {
          int index = -1;
          try {
View Full Code Here

Examples of org.springframework.beans.factory.config.ConstructorArgumentValues.addGenericArgumentValue()

          parserContext.getReaderContext().error(
              "Constructor argument '" + argName + "' already defined using <constructor-arg>." +
              " Only one approach may be used per argument.", attr);
        }
        valueHolder.setName(Conventions.attributeNameToPropertyName(argName));
        cvs.addGenericArgumentValue(valueHolder);
      }
    }
    return definition;
  }
View Full Code Here

Examples of org.springframework.beans.factory.config.ConstructorArgumentValues.addGenericArgumentValue()

    pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
    wac.registerSingleton("tb1", TestBean.class, pvs);

    ConstructorArgumentValues cas = new ConstructorArgumentValues();
    cas.addIndexedArgumentValue(1, "${age}");
    cas.addGenericArgumentValue("${var}name${age}");

    pvs = new MutablePropertyValues();
    List friends = new ManagedList();
    friends.add("na${age}me");
    friends.add(new RuntimeBeanReference("${ref}"));
View Full Code Here

Examples of org.springframework.beans.factory.config.ConstructorArgumentValues.addGenericArgumentValue()


  public void testAutowireCandidateDefaultWithIrrelevantDescriptor() throws Exception {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    ConstructorArgumentValues cavs = new ConstructorArgumentValues();
    cavs.addGenericArgumentValue(JUERGEN);
    RootBeanDefinition rbd = new RootBeanDefinition(Person.class, cavs, null);
    lbf.registerBeanDefinition(JUERGEN, rbd);
    assertTrue(lbf.isAutowireCandidate(JUERGEN, null));
    assertTrue(lbf.isAutowireCandidate(JUERGEN,
        new DependencyDescriptor(Person.class.getDeclaredField("name"), false)));
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.