Examples of registerScope()


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

  }

  private GenericApplicationContext createContext(Class<?> configClass) {
    DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    if (customScope != null) {
      beanFactory.registerScope(SCOPE, customScope);
    }
    beanFactory.registerBeanDefinition("config", new RootBeanDefinition(configClass));
    GenericApplicationContext ctx = new GenericApplicationContext(beanFactory);
    ctx.addBeanFactoryPostProcessor(new ConfigurationClassPostProcessor());
    ctx.refresh();
View Full Code Here

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

    factory.setInstantiationStrategy(new SingletonInstantiationStrategy(new CglibSubclassingInstantiationStrategy(), instances));

    // Register scopes
    for (Scope scope : scopes) {
      if (!scope.isBuiltIn()) {
        factory.registerScope(scope.name().toLowerCase(), new SpringScope(factory, scope, scopeController));
      }
    }

    //
    for (Map.Entry<String, AbstractBean> entry : beans.entrySet()) {
View Full Code Here

Examples of org.springframework.beans.factory.xml.XmlBeanFactory.registerScope()

  }

  public void testJdkScopedProxy() throws Exception {
    XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("scopedTestBean.xml", getClass()));
    SimpleMapScope scope = new SimpleMapScope();
    bf.registerScope("request", scope);

    ITestBean bean = (ITestBean) bf.getBean("testBean");
    assertNotNull(bean);
    assertTrue(AopUtils.isJdkDynamicProxy(bean));
    assertTrue(bean instanceof ScopedObject);
View Full Code Here

Examples of org.springframework.beans.factory.xml.XmlBeanFactory.registerScope()

  }

  public void testCglibScopedProxy() {
    XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("scopedList.xml", getClass()));
    SimpleMapScope scope = new SimpleMapScope();
    bf.registerScope("request", scope);

    TestBean tb = (TestBean) bf.getBean("testBean");
    assertTrue(AopUtils.isCglibProxy(tb.getFriends()));
    assertTrue(tb.getFriends() instanceof ScopedObject);
    ScopedObject scoped = (ScopedObject) tb.getFriends();
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.