Package org.springframework.beans.factory.support

Examples of org.springframework.beans.factory.support.StaticListableBeanFactory


    int beanCount = scanner.scan(BASE_PACKAGE);
    assertEquals(13, beanCount);
    context.refresh();

    FooServiceImpl fooService = (FooServiceImpl) context.getBean("fooService");
    StaticListableBeanFactory myBf = (StaticListableBeanFactory) context.getBean("myBf");
    MessageSource ms = (MessageSource) context.getBean("messageSource");
    assertTrue(fooService.isInitCalled());
    assertEquals("bar", fooService.foo(123));
    assertSame(context.getDefaultListableBeanFactory(), fooService.beanFactory);
    assertEquals(2, fooService.listableBeanFactory.size());
View Full Code Here


    TestMethodInvokingTask task1 = new TestMethodInvokingTask();
    MethodInvokingJobDetailFactoryBean mijdfb = new MethodInvokingJobDetailFactoryBean();
    mijdfb.setBeanName("myJob1");
    if (prototypeJob) {
      StaticListableBeanFactory beanFactory = new StaticListableBeanFactory();
      beanFactory.addBean("task", task1);
      mijdfb.setTargetBeanName("task");
      mijdfb.setBeanFactory(beanFactory);
    }
    else {
      mijdfb.setTargetObject(task1);
View Full Code Here

    final IsolationLevelDataSourceRouter dsToUse = new IsolationLevelDataSourceRouter();
    Map targetDataSources = new HashMap();
    if (dataSourceLookup) {
      targetDataSources.put("ISOLATION_REPEATABLE_READ", "ds2");
      dsToUse.setDefaultTargetDataSource("ds1");
      StaticListableBeanFactory beanFactory = new StaticListableBeanFactory();
      beanFactory.addBean("ds1", ds1);
      beanFactory.addBean("ds2", ds2);
      dsToUse.setDataSourceLookup(new BeanFactoryDataSourceLookup(beanFactory));
    }
    else {
      targetDataSources.put("ISOLATION_REPEATABLE_READ", ds2);
      dsToUse.setDefaultTargetDataSource(ds1);
View Full Code Here

public class FlowModelFlowBuilderTests extends TestCase {
  private FlowModel model;

  protected void setUp() {
    StaticListableBeanFactory beanFactory = new StaticListableBeanFactory();
    beanFactory.addBean("bean", new Object());
    model = new FlowModel();
  }
View Full Code Here

public class XmlFlowModelBuilderTests extends TestCase {

  private FlowModelRegistry registry;

  protected void setUp() {
    StaticListableBeanFactory beanFactory = new StaticListableBeanFactory();
    beanFactory.addBean("bean", new Object());
    registry = new FlowModelRegistryImpl();
  }
View Full Code Here

    this.listableBeanFactory = child;
  }

  @Test
  public void testHierarchicalCountBeansWithNonHierarchicalFactory() {
    StaticListableBeanFactory lbf = new StaticListableBeanFactory();
    lbf.addBean("t1", new TestBean());
    lbf.addBean("t2", new TestBean());
    assertTrue(BeanFactoryUtils.countBeansIncludingAncestors(lbf) == 2);
  }
View Full Code Here

    assertTrue(names.contains("testFactory2"));
  }

  @Test
  public void testNoBeansOfType() {
    StaticListableBeanFactory lbf = new StaticListableBeanFactory();
    lbf.addBean("foo", new Object());
    Map<?, ?> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class, true, false);
    assertTrue(beans.isEmpty());
  }
View Full Code Here

    assertTrue(beans.isEmpty());
  }

  @Test
  public void testFindsBeansOfTypeWithStaticFactory() {
    StaticListableBeanFactory lbf = new StaticListableBeanFactory();
    TestBean t1 = new TestBean();
    TestBean t2 = new TestBean();
    DummyFactory t3 = new DummyFactory();
    DummyFactory t4 = new DummyFactory();
    t4.setSingleton(false);
    lbf.addBean("t1", t1);
    lbf.addBean("t2", t2);
    lbf.addBean("t3", t3);
    lbf.addBean("t4", t4);

    Map<?, ?> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(lbf, ITestBean.class, true, false);
    assertEquals(2, beans.size());
    assertEquals(t1, beans.get("t1"));
    assertEquals(t2, beans.get("t2"));
View Full Code Here

    int beanCount = scanner.scan(BASE_PACKAGE);
    assertEquals(10, beanCount);
    context.refresh();

    FooServiceImpl fooService = context.getBean("fooService", FooServiceImpl.class);
    StaticListableBeanFactory myBf = (StaticListableBeanFactory) context.getBean("myBf");
    MessageSource ms = (MessageSource) context.getBean("messageSource");
    assertTrue(fooService.isInitCalled());
    assertEquals("bar", fooService.foo(123));
    assertSame(context.getDefaultListableBeanFactory(), fooService.beanFactory);
    assertEquals(2, fooService.listableBeanFactory.size());
View Full Code Here

  private DelegatingNavigationHandlerProxy delNavHandler;

  @Override
  protected void setUp() {
    facesContext = new MockFacesContext();
    beanFactory = new StaticListableBeanFactory();
    origNavHandler = new TestNavigationHandler();

    delNavHandler = new DelegatingNavigationHandlerProxy(origNavHandler) {
      @Override
      protected BeanFactory getBeanFactory(FacesContext facesContext) {
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.support.StaticListableBeanFactory

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.