Package org.springframework.beans.factory

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


    private Map<String,?> getBeansOfType(Class<?> type) {
        Map<String,?> beans = beanFactory.getBeansOfType(type);

        // Check ancestor bean factories if they exist and the current one has none of the required type
        BeanFactory parent = beanFactory.getParentBeanFactory();
        while (parent != null && beans.size() == 0) {
            if (parent instanceof ListableBeanFactory) {
                beans = ((ListableBeanFactory)parent).getBeansOfType(type);
            }
            if (parent instanceof HierarchicalBeanFactory) {
View Full Code Here

    public void testDefaultFactory()
    {
        SpringLookupFactory lf = new SpringLookupFactory();

        MockControl control = newControl(BeanFactory.class);
        BeanFactory beanFactory = (BeanFactory) control.getMock();

        lf.setDefaultBeanFactorySource(buildSource(beanFactory));

        List params = buildParameters("fred", null);

        Object fred = new Object();

        beanFactory.getBean("fred", List.class);
        control.setReturnValue(fred);

        replayControls();

        Object actual = lf.createCoreServiceImplementation("fred", List.class, null, params);
View Full Code Here

    public void testBeanSpecificFactory()
    {
        SpringLookupFactory lf = new SpringLookupFactory();

        MockControl control = newControl(BeanFactory.class);
        BeanFactory beanFactory = (BeanFactory) control.getMock();

        List params = buildParameters("fred", beanFactory);

        Object fred = new Object();

        beanFactory.getBean("fred", List.class);
        control.setReturnValue(fred);

        replayControls();

        Object actual = lf.createCoreServiceImplementation("fred", List.class, null, params);
View Full Code Here

        // Spring setup

        ClassPathResource springBeansResource =
            new ClassPathResource("SpringBeans.xml", TestSpringLookupFactory.class);

        BeanFactory beanFactory = new XmlBeanFactory(springBeansResource);

        Registry r = buildFrameworkRegistry("SpringIntegration.sdl");

        SpringBeanFactoryHolder h =
            (SpringBeanFactoryHolder) r.getService(
View Full Code Here

  private static final String CONTEXT_BEAN = "bean-context";

  public static Object getBean(ServletContext context, String name) {
    ClassPathXmlApplicationContext ecoContext = (ClassPathXmlApplicationContext) WebApplicationContextUtils.getWebApplicationContext(
        context).getBean(CONTEXT_BEAN);
    BeanFactory beanFactory = ecoContext.getBeanFactory();
    Object object = beanFactory.getBean(name);

    return object;
  }
View Full Code Here

    return batchContext.getBean(name);
  }

  public static Object getBean(WebApplicationContext wac, String name) {
    ClassPathXmlApplicationContext ecoContext = (ClassPathXmlApplicationContext) wac.getBean(CONTEXT_BEAN);
    BeanFactory beanFactory = ecoContext.getBeanFactory();
    Object object = beanFactory.getBean(name);

    return object;
  }
View Full Code Here

            throw new TuboResourceException("Tubo configuration can't be created",e);
        }
        //
        // create Bean Factory
        ByteArrayResource byteResource = new ByteArrayResource(stringResource.getBytes());
        BeanFactory beanFactory = new XmlBeanFactory(byteResource);
        //
        // get resource manager
        SpringResourceManagerImpl rm = null;
        try {
            //
            // get FlowExecutor via Spring
            rm = (SpringResourceManagerImpl)beanFactory.getBean(SPRING_RESOURCE_MANAGER_BEAN_ID);
        } catch (BeansException e) {
            //
            // log error
            log.error("Error trying to get ResourceManager", e);
            //
View Full Code Here

*/
public class LookupPerformance {

    public static void main(String[] args) {

        BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "./ch5/src/conf/mi/lookup.xml"));

        DemoBean abstractBean = (DemoBean) factory.getBean("abstractLookupBean");
        DemoBean factoryBean = (DemoBean) factory.getBean("factoryLookupBean");

        testPerf(abstractBean);
        testPerf(factoryBean);
    }
View Full Code Here

* @author robh
*/
public class LookupDemo {

    public static void main(String[] args) {
        BeanFactory factory = new XmlBeanFactory(new FileSystemResource(
                "./ch5/src/conf/mi/lookup.xml"));

        DemoBean abstractBean = (DemoBean) factory.getBean("abstractLookupBean");
        DemoBean standardBean = (DemoBean) factory.getBean("standardLookupBean");

        displayInfo(standardBean);
        displayInfo(abstractBean);

    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.BeanFactory

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.