Examples of GenericBeanDefinition


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

  }

  private void setupContext() {
    applicationContext = new GenericApplicationContext();

    GenericBeanDefinition definition = new GenericBeanDefinition();
    definition.setBeanClass(MockSqlSessionDao.class);
    applicationContext.registerBeanDefinition("dao", definition);

    // add support for autowiring fields
    AnnotationConfigUtils.registerAnnotationConfigProcessors(applicationContext);
  }
View Full Code Here

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

    sqlSessionDaoSupport = applicationContext.getBean(MockSqlSessionDao.class);
  }

  private void setupSqlSessionFactory(String name) {
    GenericBeanDefinition definition = new GenericBeanDefinition();
    definition.setBeanClass(SqlSessionFactoryBean.class);
    definition.getPropertyValues().add("dataSource", dataSource);

    applicationContext.registerBeanDefinition(name, definition);
  }
View Full Code Here

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

    assertBeanNotLoaded("mapperInterface");
  }

  @Test
  public void testScanWithNameConflict() {
    GenericBeanDefinition definition = new GenericBeanDefinition();
    definition.setBeanClass(Object.class);
    applicationContext.registerBeanDefinition("mapperInterface", definition);

    applicationContext.register(AppConfigWithPackageScan.class);

    startContext();
View Full Code Here

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

    assertSame("scanner should not overwite existing bean definition", applicationContext.getBean("mapperInterface").getClass(), Object.class);
  }

  private void setupSqlSessionFactory(String name) {
    GenericBeanDefinition definition = new GenericBeanDefinition();
    definition.setBeanClass(SqlSessionFactoryBean.class);
    definition.getPropertyValues().add("dataSource", new MockDataSource());
    applicationContext.registerBeanDefinition(name, definition);
  }
View Full Code Here

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

    applicationContext.getBean("annotatedMapper");
  }

  @Test
  public void testScanWithExplicitSqlSessionTemplate() throws Exception {
    GenericBeanDefinition definition = new GenericBeanDefinition();
    definition.setBeanClass(SqlSessionTemplate.class);
    ConstructorArgumentValues constructorArgs = new ConstructorArgumentValues();
    constructorArgs.addGenericArgumentValue(new RuntimeBeanReference("sqlSessionFactory"));
    definition.setConstructorArgumentValues(constructorArgs);
    applicationContext.registerBeanDefinition("sqlSessionTemplate", definition);

    applicationContext.register(AppConfigWithSqlSessionTemplate.class);
   
    startContext();
View Full Code Here

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

    public void testPostProcessBeanFactoryWithoutMocking()
    {
        MunitApplicationContextPostProcessor pp = new MunitApplicationContextPostProcessor();
        pp.setMockInbounds(false);
        pp.setMockingExcludedFlows(new ArrayList<String>());
        when(beanFactory.getBeanDefinition(MuleProperties.OBJECT_MULE_ENDPOINT_FACTORY)).thenReturn(new GenericBeanDefinition());

        pp.postProcessBeanFactory(beanFactory);

        verify(beanFactory, times(1)).getBeanDefinition(any(String.class));
    }
View Full Code Here

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

        pp.setMockInbounds(true);
        pp.setMockingExcludedFlows(new ArrayList<String>());

        when(beanFactory.getBeanDefinitionNames()).thenReturn(new String[] {"beanName"});
        when(beanFactory.getBeanDefinition("beanName")).thenReturn(createBeanDefinition());
        when(beanFactory.getBeanDefinition(MuleProperties.OBJECT_MULE_ENDPOINT_FACTORY)).thenReturn(new GenericBeanDefinition());
        pp.postProcessBeanFactory(beanFactory);

    }
View Full Code Here

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

        pp.setMockingExcludedFlows(new ArrayList<String>());

        when(beanFactory.getBeanDefinitionNames()).thenReturn(new String[] {"beanName"});
        when(beanFactory.getBeanNamesForType(Connector.class)).thenReturn(new String[] {"beanName"});
        when(beanFactory.getBeanDefinition("beanName")).thenReturn(createConnectionDefinition());
        when(beanFactory.getBeanDefinition(MuleProperties.OBJECT_MULE_ENDPOINT_FACTORY)).thenReturn(new GenericBeanDefinition());

        pp.postProcessBeanFactory(beanFactory);
    }
View Full Code Here

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

  {
    //leverage the Scripting post processor
    LangNamespaceUtils.registerScriptFactoryPostProcessorIfNecessary(parserContext.getRegistry());
   
    //do a bean definition
    GenericBeanDefinition beanDef = new GenericBeanDefinition();
   
    beanDef.setSource(parserContext.extractSource(element));
    beanDef.setBeanClass(ColdFusionComponentFactory.class);
   
    // Determine bean scope.
    String scope = element.getAttribute(SCOPE_ATTRIBUTE);
    if (StringUtils.hasLength(scope))
    {
      beanDef.setScope(scope);
    }
   
    // Determine autowire mode.
    String autowire = element.getAttribute(AUTOWIRE_ATTRIBUTE);
   
    int autowireMode = parserContext.getDelegate().getAutowireMode(autowire);
    // Only "byType" and "byName" supported, but maybe other default
    // inherited...
   
    if (autowireMode == GenericBeanDefinition.AUTOWIRE_AUTODETECT)
    {
      autowireMode = GenericBeanDefinition.AUTOWIRE_BY_TYPE;
    }
    else if (autowireMode == GenericBeanDefinition.AUTOWIRE_CONSTRUCTOR)
    {
      autowireMode = GenericBeanDefinition.AUTOWIRE_NO;
    }
    beanDef.setAutowireMode(autowireMode);

    // Determine dependency check setting.
    String dependencyCheck = element.getAttribute(DEPENDENCY_CHECK_ATTRIBUTE);
    beanDef.setDependencyCheck(parserContext.getDelegate().getDependencyCheck(dependencyCheck));

    // Retrieve the defaults for bean definitions within this parser context
    BeanDefinitionDefaults beanDefinitionDefaults = parserContext.getDelegate().getBeanDefinitionDefaults();

    // Determine init method and destroy method.
    String initMethod = element.getAttribute(INIT_METHOD_ATTRIBUTE);
    if (StringUtils.hasLength(initMethod))
    {
      beanDef.setInitMethodName(initMethod);
    }
    else if (beanDefinitionDefaults.getInitMethodName() != null)
    {
      beanDef.setInitMethodName(beanDefinitionDefaults.getInitMethodName());
    }

    String destroyMethod = element.getAttribute(DESTROY_METHOD_ATTRIBUTE);
    if (StringUtils.hasLength(destroyMethod))
    {
      beanDef.setDestroyMethodName(destroyMethod);
    }
    else if (beanDefinitionDefaults.getDestroyMethodName() != null)
    {
      beanDef.setDestroyMethodName(beanDefinitionDefaults.getDestroyMethodName());
    }
   
    ConstructorArgumentValues constructorArgs = beanDef.getConstructorArgumentValues();
   
    String scriptSource = element.getAttribute(SCRIPT_SOURCE_ATTRIBUTE);
   
    //have to do this here, as otherwise the Script post processor will take over
    if(!element.hasAttribute(SCRIPT_SOURCE_RELATIVE_ATTRIBUTE) || element.getAttribute(SCRIPT_SOURCE_RELATIVE_ATTRIBUTE).equals("true"))
View Full Code Here

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

                sb.append(fullPath).append("=").append(controllerName).append("\n");
            }

        }

        GenericBeanDefinition mapperDef = new GenericBeanDefinition();
        mapperDef.setBeanClass(SimpleUrlHandlerMapping.class);
        MutablePropertyValues propertyValues = new MutablePropertyValues();
        propertyValues.addPropertyValue("mappings", new TypedStringValue(sb.toString()));
        mapperDef.setPropertyValues(propertyValues);
        ((BeanDefinitionRegistry) beanFactory).registerBeanDefinition("__urlMapper", mapperDef);


        for (String name : names) {
            GenericBeanDefinition definition = new GenericBeanDefinition();
            definition.setBeanClass(GwtRpcController.class);

            propertyValues = new MutablePropertyValues();
            propertyValues.addPropertyValue("remoteService", new RuntimeBeanReference(name));
            if (unexpectedExceptionMappingsBeanName != null) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Registering unexpected exception mappings on controler: " + name + "Controller");
                }
                propertyValues.addPropertyValue("unexpectedExceptionMappings", new RuntimeBeanReference(unexpectedExceptionMappingsBeanName));
            }
            definition.setPropertyValues(propertyValues);

            if (logger.isDebugEnabled()) {
                logger.debug("Registering controller: " + name + "Controller");
            }
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.