Examples of autowire()


Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowire()

    RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
    bd.setPropertyValues(pvs);
    lbf.registerBeanDefinition("rod", bd);
    assertEquals(1, lbf.getBeanDefinitionCount());
    // Depends on age, name and spouse (TestBean)
    Object registered = lbf.autowire(DependenciesBean.class, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, true);
    assertEquals(1, lbf.getBeanDefinitionCount());
    DependenciesBean kerry = (DependenciesBean) registered;
    TestBean rod = (TestBean) lbf.getBean("rod");
    assertSame(rod, kerry.getSpouse());
  }
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowire()

    pvs.add("name", "Rod");
    RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
    bd.setPropertyValues(pvs);
    lbf.registerBeanDefinition("rod", bd);
    assertEquals(1, lbf.getBeanDefinitionCount());
    Object registered = lbf.autowire(ConstructorDependency.class, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false);
    assertEquals(1, lbf.getBeanDefinitionCount());
    ConstructorDependency kerry = (ConstructorDependency) registered;
    TestBean rod = (TestBean) lbf.getBean("rod");
    assertSame(rod, kerry.spouse);
  }
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowire()

    RootBeanDefinition bd = new RootBeanDefinition(TestBean.class);
    lbf.registerBeanDefinition("rod", bd);
    RootBeanDefinition bd2 = new RootBeanDefinition(TestBean.class);
    lbf.registerBeanDefinition("rod2", bd2);
    try {
      lbf.autowire(ConstructorDependency.class, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false);
      fail("Should have thrown UnsatisfiedDependencyException");
    }
    catch (UnsatisfiedDependencyException ex) {
      // expected
      assertTrue(ex.getMessage().contains("rod"));
View Full Code Here

Examples of org.springframework.config.java.annotation.AutoBean.autowire()

        throw new BeanDefinitionStoreException("Cannot use AutoBean of interface type " + m.getReturnType()
            + ": don't know what class to instantiate; processing @AutoBean method " + m);
      }

      RootBeanDefinition bd = new RootBeanDefinition(m.getReturnType());
      bd.setAutowireMode(autoBean.autowire().value());
      configurationProcessor.registerBeanDefinition(m.getName(), bd, !Modifier.isPublic(m.getModifiers()));
      // one bean definition created
      configurationProcessor.beanDefsGenerated++;
    }
View Full Code Here

Examples of org.springframework.config.java.annotation.Bean.autowire()

      Bean bean = AnnotationUtils.findAnnotation(m, Bean.class);

      // TODO need to consider autowiring enabled at factory level - reuse
      // the
      // detection from ConfigurationProcessor
      return !m.getReturnType().isInterface() || bean.autowire().isAutowire();
    }

  }
}
View Full Code Here

Examples of org.zanata.seam.SeamAutowire.autowire()

                .useImpl(ValidationServiceImpl.class)
                .useImpl(VersionStateCacheImpl.class)
                .useImpl(TranslationStateCacheImpl.class);

        SourceDocResourceService sourceDocResourceService =
                seamAutowire.autowire(SourceDocResourceService.class);
        TranslatedDocResourceService translatedDocResourceService =
                seamAutowire.autowire(TranslatedDocResourceService.class);

        resources.add(sourceDocResourceService);
        resources.add(translatedDocResourceService);
View Full Code Here

Examples of org.zanata.seam.SeamAutowire.autowire()

                .useImpl(TranslationStateCacheImpl.class);

        SourceDocResourceService sourceDocResourceService =
                seamAutowire.autowire(SourceDocResourceService.class);
        TranslatedDocResourceService translatedDocResourceService =
                seamAutowire.autowire(TranslatedDocResourceService.class);

        resources.add(sourceDocResourceService);
        resources.add(translatedDocResourceService);
    }
View Full Code Here

Examples of org.zanata.seam.SeamAutowire.autowire()

                .useImpl(CopyTransServiceImpl.class)
                .useImpl(LocaleServiceImpl.class)
                .simulateSessionContext(true);

        CopyTransResource copyTransResource =
                seamAutowire.autowire(CopyTransResourceService.class);

        resources.add(copyTransResource);
    }

    @Override
View Full Code Here

Examples of org.zanata.seam.SeamAutowire.autowire()

    protected void prepareResources() {
        SeamAutowire seamAutowire = getSeamAutowire();
        seamAutowire.use("session", getSession()).use("identity", mockIdentity);

        ProjectService projectService =
                seamAutowire.autowire(ProjectService.class);

        resources.add(projectService);
    }

    @Test
View Full Code Here

Examples of org.zanata.seam.SeamAutowire.autowire()

    protected void prepareResources() {
        SeamAutowire seamAutowire = getSeamAutowire();
        seamAutowire.use("session", getSession());

        ProjectIterationService projectIterationService =
                seamAutowire.autowire(ProjectIterationService.class);

        resources.add(projectIterationService);
    }

    @Test
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.