Package org.springframework.beans.factory.config

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


    registerSingleton("myPortlet", MyPortlet.class);
    registerSingleton("portletMultipartResolver", MockMultipartResolver.class);
    registerSingleton("portletPostProcessor", SimplePortletPostProcessor.class);
    registerSingleton("testListener", TestApplicationListener.class);
   
    ConstructorArgumentValues cvs = new ConstructorArgumentValues();
    cvs.addIndexedArgumentValue(0, new MockPortletContext());
    cvs.addIndexedArgumentValue(1, "complex");
    registerBeanDefinition("portletConfig", new RootBeanDefinition(MockPortletConfig.class, cvs, null));
   
    UserRoleAuthorizationInterceptor userRoleInterceptor = new UserRoleAuthorizationInterceptor();
    userRoleInterceptor.setAuthorizedRoles(new String[] {"role1", "role2"});
View Full Code Here


    pvs.addPropertyValue("age", "${age}");
    pvs.addPropertyValue("name", "name${var}${var}${");
    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

  private static final String MARK = "mark";


  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

        new DependencyDescriptor(Person.class.getDeclaredField("name"), true)));
  }

  public void testAutowireCandidateExplicitlyFalseWithIrrelevantDescriptor() throws Exception {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    ConstructorArgumentValues cavs = new ConstructorArgumentValues();
    cavs.addGenericArgumentValue(JUERGEN);
    RootBeanDefinition rbd = new RootBeanDefinition(Person.class, cavs, null);
    rbd.setAutowireCandidate(false);
    lbf.registerBeanDefinition(JUERGEN, rbd);
    assertFalse(lbf.isAutowireCandidate(JUERGEN, null));
    assertFalse(lbf.isAutowireCandidate(JUERGEN,
View Full Code Here

        new DependencyDescriptor(Person.class.getDeclaredField("name"), true)));
  }

  public void testAutowireCandidateWithFieldDescriptor() throws Exception {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory()
    ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
    cavs1.addGenericArgumentValue(JUERGEN);
    RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null);
    person1.addQualifier(new AutowireCandidateQualifier(TestQualifier.class));
    lbf.registerBeanDefinition(JUERGEN, person1);
    ConstructorArgumentValues cavs2 = new ConstructorArgumentValues();
    cavs2.addGenericArgumentValue(MARK);
    RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null);
    lbf.registerBeanDefinition(MARK, person2);
    DependencyDescriptor qualifiedDescriptor = new DependencyDescriptor(
        QualifiedTestBean.class.getDeclaredField("qualified"), false);
    DependencyDescriptor nonqualifiedDescriptor = new DependencyDescriptor(
View Full Code Here

    assertFalse(lbf.isAutowireCandidate(MARK, qualifiedDescriptor));
  }

  public void testAutowireCandidateExplicitlyFalseWithFieldDescriptor() throws Exception {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory()
    ConstructorArgumentValues cavs = new ConstructorArgumentValues();
    cavs.addGenericArgumentValue(JUERGEN);
    RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null);
    person.setAutowireCandidate(false);
    person.addQualifier(new AutowireCandidateQualifier(TestQualifier.class));
    lbf.registerBeanDefinition(JUERGEN, person);
    DependencyDescriptor qualifiedDescriptor = new DependencyDescriptor(
View Full Code Here

    assertFalse(lbf.isAutowireCandidate(JUERGEN, qualifiedDescriptor));
  }

  public void testAutowireCandidateWithShortClassName() throws Exception {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory()
    ConstructorArgumentValues cavs = new ConstructorArgumentValues();
    cavs.addGenericArgumentValue(JUERGEN);
    RootBeanDefinition person = new RootBeanDefinition(Person.class, cavs, null);
    person.addQualifier(new AutowireCandidateQualifier(ClassUtils.getShortName(TestQualifier.class)));
    lbf.registerBeanDefinition(JUERGEN, person);
    DependencyDescriptor qualifiedDescriptor = new DependencyDescriptor(
        QualifiedTestBean.class.getDeclaredField("qualified"), false);
View Full Code Here

    assertTrue(lbf.isAutowireCandidate(JUERGEN, qualifiedDescriptor));
  }

  public void testAutowireCandidateWithConstructorDescriptor() throws Exception {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory()
    ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
    cavs1.addGenericArgumentValue(JUERGEN);
    RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null);
    person1.addQualifier(new AutowireCandidateQualifier(TestQualifier.class));
    lbf.registerBeanDefinition(JUERGEN, person1);
    ConstructorArgumentValues cavs2 = new ConstructorArgumentValues();
    cavs2.addGenericArgumentValue(MARK);
    RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null);
    lbf.registerBeanDefinition(MARK, person2);
    MethodParameter param = new MethodParameter(QualifiedTestBean.class.getDeclaredConstructor(Person.class), 0);
    DependencyDescriptor qualifiedDescriptor = new DependencyDescriptor(param, false);
    param.initParameterNameDiscovery(new LocalVariableTableParameterNameDiscoverer());
View Full Code Here

    assertFalse(lbf.isAutowireCandidate(MARK, qualifiedDescriptor));
  }

  public void testAutowireCandidateWithMethodDescriptor() throws Exception {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory()
    ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
    cavs1.addGenericArgumentValue(JUERGEN);
    RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null);
    person1.addQualifier(new AutowireCandidateQualifier(TestQualifier.class));
    lbf.registerBeanDefinition(JUERGEN, person1);
    ConstructorArgumentValues cavs2 = new ConstructorArgumentValues();
    cavs2.addGenericArgumentValue(MARK);
    RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null);
    lbf.registerBeanDefinition(MARK, person2);
    MethodParameter qualifiedParam =
        new MethodParameter(QualifiedTestBean.class.getDeclaredMethod("autowireQualified", Person.class), 0);
    MethodParameter nonqualifiedParam =
View Full Code Here

    assertFalse(lbf.isAutowireCandidate(MARK, qualifiedDescriptor));
  }

  public void testAutowireCandidateWithMultipleCandidatesDescriptor() throws Exception {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory()
    ConstructorArgumentValues cavs1 = new ConstructorArgumentValues();
    cavs1.addGenericArgumentValue(JUERGEN);
    RootBeanDefinition person1 = new RootBeanDefinition(Person.class, cavs1, null);
    person1.addQualifier(new AutowireCandidateQualifier(TestQualifier.class));
    lbf.registerBeanDefinition(JUERGEN, person1);
    ConstructorArgumentValues cavs2 = new ConstructorArgumentValues();
    cavs2.addGenericArgumentValue(MARK);
    RootBeanDefinition person2 = new RootBeanDefinition(Person.class, cavs2, null);
    person2.addQualifier(new AutowireCandidateQualifier(TestQualifier.class));
    lbf.registerBeanDefinition(MARK, person2);
    DependencyDescriptor qualifiedDescriptor = new DependencyDescriptor(
        new MethodParameter(QualifiedTestBean.class.getDeclaredConstructor(Person.class), 0),
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.