Examples of BeanFactory


Examples of org.springframework.beans.factory.BeanFactory

    }
  }

  public void testCleanBeanFactoryReferences() throws Exception {
    // invoke a reference
    BeanFactory factory = proxy.retrieveBeanFactory();
    assertSame(bf, factory);
  }
View Full Code Here

Examples of org.springframework.beans.factory.BeanFactory

    MockControl factoryControl = MockControl.createControl(ObjectFactory.class);
    ObjectFactory mockFactory = (ObjectFactory) factoryControl.getMock();
    configuration.setObjectFactory(mockFactory);

    MockControl beanFactoryControl = MockControl.createNiceControl(BeanFactory.class);
    BeanFactory beanFactory = (BeanFactory) beanFactoryControl.getMock();

    JbpmContext context = new JbpmContext(null, mockFactory);
    factoryControl.expectAndReturn(mockFactory.createObject(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME), context, 3);
    beanFactoryControl.replay();
    factoryControl.replay();
View Full Code Here

Examples of org.springframework.beans.factory.BeanFactory

    sCtrl.verify();
    queryCtrl.verify();
  }

  public void testBeanFactoryRelease() throws Exception {
    BeanFactory beanFactory = new DefaultListableBeanFactory();
   
    configuration.setConfiguration(configurationResource);
    configuration.setBeanFactory(beanFactory);
    configuration.afterPropertiesSet();
   
    // make sure we have some sort of configuration
    assertNotNull(configuration.getObject());
   
    JbpmFactoryLocator locator = configuration.getFactoryLocator();
    JbpmHandlerProxy proxy = new JbpmHandlerProxy();
    BeanFactory bf = proxy.retrieveBeanFactory();
    assertSame(beanFactory, bf);
 
    // the reference to the bean factory locator should be removed
    configuration.destroy();
   
View Full Code Here

Examples of org.springframework.beans.factory.BeanFactory

    BeanFactoryReference reference2 = locator2.useBeanFactory(INSTANCE_2);
    BeanFactoryReference aliasRef1 = locator1.useBeanFactory("alias1");
    BeanFactoryReference aliasRef2 = locator1.useBeanFactory("alias2");

    // verify the static map
    BeanFactory factory1 = reference1.getFactory();
    BeanFactory factory2 = reference2.getFactory();
    BeanFactory factory3 = reference2.getFactory();
    // get the alias from different factories
    BeanFactory alias1 = aliasRef1.getFactory();
    BeanFactory alias2 = aliasRef2.getFactory();

    assertSame(factory1, factory2);
    assertSame(factory1, factory3);
    // verify it's the same bean factory as the application context
    assertSame(factory1, applicationContext.getBeanFactory());
View Full Code Here

Examples of org.springframework.beans.factory.BeanFactory

        this.springBeanFactoryHolder = springBeanFactoryHolder;
    }

    public void initialize(HttpServlet servlet) {
        ServletContext servletContext = servlet.getServletContext();
        BeanFactory beanFactory = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        this.springBeanFactoryHolder.setBeanFactory(beanFactory);
    }
View Full Code Here

Examples of org.springframework.beans.factory.BeanFactory

    BeanFactoryReference reference2 = locator2.useBeanFactory(INSTANCE_2);
    BeanFactoryReference aliasRef1 = locator1.useBeanFactory("alias1");
    BeanFactoryReference aliasRef2 = locator1.useBeanFactory("alias2");

    // verify the static map
    BeanFactory factory1 = reference1.getFactory();
    BeanFactory factory2 = reference2.getFactory();
    BeanFactory factory3 = reference2.getFactory();
    // get the alias from different factories
    BeanFactory alias1 = aliasRef1.getFactory();
    BeanFactory alias2 = aliasRef2.getFactory();

    assertSame(factory1, factory2);
    assertSame(factory1, factory3);
    // verify it's the same bean factory as the application context
    assertSame(factory1, applicationContext.getBeanFactory());
View Full Code Here

Examples of org.springframework.beans.factory.BeanFactory

  /**
   * @see org.springframework.beans.factory.access.BeanFactoryLocator#useBeanFactory(java.lang.String)
   */
  public BeanFactoryReference useBeanFactory(String factoryKey) throws BeansException {
    // see if there is a default FactoryBean
    BeanFactory factory;

    if (factoryKey == null) {
      if (!canUseDefaultBeanFactory)
        throw new IllegalArgumentException(
            "a non-null factoryKey needs to be specified as there are more then one factoryKeys available ");
      factory = defaultFactory;
    }
    else {
      factory = (BeanFactory) beanFactories.get(factoryKey);
      if (factory == null)
        throw new IllegalArgumentException("there is no beanFactory under key " + factoryKey);
    }

    // increment counter
    synchronized (referenceCounter) {
      Integer counter = (Integer) referenceCounter.get(factory);
      referenceCounter.put(factory, new Integer(counter.intValue() + 1));
    }

    final BeanFactory finalFactory = factory;

    // simple implementation
    return new BeanFactoryReference() {
      private BeanFactory fact = finalFactory;

View Full Code Here

Examples of org.springframework.beans.factory.BeanFactory

  /**
   * @see org.springframework.beans.factory.access.BeanFactoryLocator#useBeanFactory(java.lang.String)
   */
  public BeanFactoryReference useBeanFactory(String factoryKey) throws BeansException {
    // see if there is a default FactoryBean
    BeanFactory factory;

    if (factoryKey == null) {
      if (!canUseDefaultBeanFactory)
        throw new IllegalArgumentException(
            "a non-null factoryKey needs to be specified as there are more then one factoryKeys available ");
      factory = defaultFactory;
    }
    else {
      factory = (BeanFactory) beanFactories.get(factoryKey);
      if (factory == null)
        throw new IllegalArgumentException("there is no beanFactory under key " + factoryKey);
    }

    // increment counter
    synchronized (referenceCounter) {
      Integer counter = (Integer) referenceCounter.get(factory);
      referenceCounter.put(factory, new Integer(counter.intValue() + 1));
    }

    final BeanFactory finalFactory = factory;

    // simple implementation
    return new BeanFactoryReference() {
      private BeanFactory fact = finalFactory;

View Full Code Here

Examples of org.springframework.beans.factory.BeanFactory

        servlet.init(servletConfig);

        Registry hiveMindRegistry = (Registry) servletContext.getAttribute("org.apache.tapestry.Registry:servlet");
        assertNotNull("HiveMind registry is not available in servlet context", hiveMindRegistry);

        BeanFactory beanFactory = (BeanFactory) hiveMindRegistry.getService("hivemind.lib.DefaultSpringBeanFactory", BeanFactory.class);
        String name = (String) beanFactory.getBean("name", String.class);
        assertNotNull(name);
        assertEquals("Steven Devijver", name);
    }
View Full Code Here

Examples of org.springframework.beans.factory.BeanFactory

    {
      return beanFactory.getBeanDefinition(name);
    }
    else
    {
      BeanFactory parent = beanFactory.getParentBeanFactory();
      if ((parent != null) && (parent instanceof ConfigurableListableBeanFactory))
      {
        return getBeanDefinition((ConfigurableListableBeanFactory)parent, name);
      }
      else
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.