Examples of registerPrototype()


Examples of org.springframework.context.support.StaticApplicationContext.registerPrototype()

    }

    @Test
    public void endpointPrototype() throws Exception {
        StaticApplicationContext applicationContext = new StaticApplicationContext();
        applicationContext.registerPrototype("endpoint", MyEndpoint.class);

        AbstractEndpointMapping mapping = new AbstractEndpointMapping() {

            @Override
            protected Object getEndpointInternal(MessageContext message) throws Exception {
View Full Code Here

Examples of org.springframework.context.support.StaticApplicationContext.registerPrototype()

    }.runTest();
  }

  public void testCombinedLocatorInterface() {
    StaticApplicationContext ctx = new StaticApplicationContext();
    ctx.registerPrototype("testService", TestService.class, new MutablePropertyValues());
    ctx.registerAlias("testService", "1");
    MutablePropertyValues mpv = new MutablePropertyValues();
    mpv.addPropertyValue("serviceLocatorInterface", TestServiceLocator3.class);
    ctx.registerSingleton("factory", ServiceLocatorFactoryBean.class, mpv);
    ctx.refresh();
View Full Code Here

Examples of org.springframework.context.support.StaticApplicationContext.registerPrototype()

    assertTrue(factory.toString().indexOf("TestServiceLocator3") != -1);
  }

  public void testServiceMappings() {
    StaticApplicationContext ctx = new StaticApplicationContext();
    ctx.registerPrototype("testService1", TestService.class, new MutablePropertyValues());
    ctx.registerPrototype("testService2", ExtendedTestService.class, new MutablePropertyValues());
    MutablePropertyValues mpv = new MutablePropertyValues();
    mpv.addPropertyValue("serviceLocatorInterface", TestServiceLocator3.class);
    mpv.addPropertyValue("serviceMappings", "=testService1\n1=testService1\n2=testService2");
    ctx.registerSingleton("factory", ServiceLocatorFactoryBean.class, mpv);
View Full Code Here

Examples of org.springframework.context.support.StaticApplicationContext.registerPrototype()

  }

  public void testServiceMappings() {
    StaticApplicationContext ctx = new StaticApplicationContext();
    ctx.registerPrototype("testService1", TestService.class, new MutablePropertyValues());
    ctx.registerPrototype("testService2", ExtendedTestService.class, new MutablePropertyValues());
    MutablePropertyValues mpv = new MutablePropertyValues();
    mpv.addPropertyValue("serviceLocatorInterface", TestServiceLocator3.class);
    mpv.addPropertyValue("serviceMappings", "=testService1\n1=testService1\n2=testService2");
    ctx.registerSingleton("factory", ServiceLocatorFactoryBean.class, mpv);
    ctx.refresh();
View Full Code Here

Examples of org.springframework.context.support.StaticApplicationContext.registerPrototype()

    String expectedLoadBean2Message = "LoadBeanTestMessage beanName2";

    StaticApplicationContext appCtx = new StaticApplicationContext();
    appCtx.registerSingleton(beanName1, Object.class);
    appCtx.registerSingleton(beanName2, Object.class);
    appCtx.registerPrototype(beanName3, Object.class);

    StaticMessageSource messageSource = new StaticMessageSource();

    messageSource.addMessage(ProgressMonitoringBeanFactoryPostProcessor.LOADING_APP_CONTEXT_KEY, Locale
        .getDefault(), loadingAppCtxMessage);
View Full Code Here

Examples of org.springframework.context.support.StaticApplicationContext.registerPrototype()

    String beanName3 = "beanName3";

    StaticApplicationContext appCtx = new StaticApplicationContext();
    appCtx.registerSingleton(beanName1, Object.class);
    appCtx.registerSingleton(beanName2, Object.class);
    appCtx.registerPrototype(beanName3, Object.class);

    ProgressMonitor mockProgressMonitor = (ProgressMonitor) EasyMock.createStrictMock(ProgressMonitor.class);
    mockProgressMonitor.taskStarted("Loading Application Context ...", expectedSingletonBeanCount);
    mockProgressMonitor.subTaskStarted("Loading " + beanName1 + " ...");
    mockProgressMonitor.worked(1);
View Full Code Here

Examples of org.springframework.context.support.StaticApplicationContext.registerPrototype()

  public void testCustomAutoProxyCreator() {
    StaticApplicationContext sac = new StaticApplicationContext();
    sac.registerSingleton("testAutoProxyCreator", TestAutoProxyCreator.class);
    sac.registerSingleton("singletonNoInterceptor", TestBean.class);
    sac.registerSingleton("singletonToBeProxied", TestBean.class);
    sac.registerPrototype("prototypeToBeProxied", TestBean.class);
    sac.refresh();

    MessageSource messageSource = (MessageSource) sac.getBean("messageSource");
    ITestBean singletonNoInterceptor = (ITestBean) sac.getBean("singletonNoInterceptor");
    ITestBean singletonToBeProxied = (ITestBean) sac.getBean("singletonToBeProxied");
View Full Code Here

Examples of org.springframework.context.support.StaticApplicationContext.registerPrototype()

  private void prepareTargetSource(CommonsPoolTargetSource targetSource) {
    String beanName = "target";

    StaticApplicationContext applicationContext = new StaticApplicationContext();
    applicationContext.registerPrototype(beanName, SerializablePerson.class);

    targetSource.setTargetBeanName(beanName);
    targetSource.setBeanFactory(applicationContext);
  }
View Full Code Here

Examples of org.springframework.context.support.StaticApplicationContext.registerPrototype()

    sac.registerSingleton("testAutoProxyCreator", TestAutoProxyCreator.class);
    sac.registerSingleton("noInterfaces", NoInterfaces.class);
    sac.registerSingleton("containerCallbackInterfacesOnly", ContainerCallbackInterfacesOnly.class);
    sac.registerSingleton("singletonNoInterceptor", TestBean.class);
    sac.registerSingleton("singletonToBeProxied", TestBean.class);
    sac.registerPrototype("prototypeToBeProxied", TestBean.class);
    sac.refresh();

    MessageSource messageSource = (MessageSource) sac.getBean("messageSource");
    NoInterfaces noInterfaces = (NoInterfaces) sac.getBean("noInterfaces");
    ContainerCallbackInterfacesOnly containerCallbackInterfacesOnly =
View Full Code Here

Examples of org.springframework.context.support.StaticApplicationContext.registerPrototype()

    sac.registerSingleton("testAutoProxyCreator", FallbackTestAutoProxyCreator.class);
    sac.registerSingleton("noInterfaces", NoInterfaces.class);
    sac.registerSingleton("containerCallbackInterfacesOnly", ContainerCallbackInterfacesOnly.class);
    sac.registerSingleton("singletonNoInterceptor", TestBean.class);
    sac.registerSingleton("singletonToBeProxied", TestBean.class);
    sac.registerPrototype("prototypeToBeProxied", TestBean.class);
    sac.refresh();

    MessageSource messageSource = (MessageSource) sac.getBean("messageSource");
    NoInterfaces noInterfaces = (NoInterfaces) sac.getBean("noInterfaces");
    ContainerCallbackInterfacesOnly containerCallbackInterfacesOnly =
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.