Package org.springframework.beans.factory.support

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


            builder.addPropertyValue(propertyName, propertyValue);
        }
    }

    private RootBeanDefinition createBeanDefinition(Class<?> beanClass, Object source) {
        RootBeanDefinition beanDefinition = new RootBeanDefinition(beanClass);
        beanDefinition.setSource(source);
        beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        return beanDefinition;
    }
View Full Code Here


    if (customImplementationBeanName != null) {
      builder.addPropertyReference("customImplementation", customImplementationBeanName);
      builder.addDependsOn(customImplementationBeanName);
    }

    RootBeanDefinition evaluationContextProviderDefinition = new RootBeanDefinition(
        ExtensionAwareEvaluationContextProvider.class);
    evaluationContextProviderDefinition.setSource(configuration.getSource());

    builder.addPropertyValue("evaluationContextProvider", evaluationContextProviderDefinition);

    return builder;
  }
View Full Code Here

    if (registry.containsBeanDefinition(beanName)) {
      return;
    }

    // Register extension as bean to indicate repository parsing and registration has happened
    RootBeanDefinition definition = new RootBeanDefinition(extensionType);
    definition.setSource(configurationSource.getSource());
    definition.setRole(AbstractBeanDefinition.ROLE_INFRASTRUCTURE);
    definition.setLazyInit(true);

    registry.registerBeanDefinition(beanName, definition);
  }
View Full Code Here

    private static Class<?> getBeanClass(String name, BeanDefinition beanDef,
                                         ConfigurableListableBeanFactory beanFactory)
    {
        if (beanDef instanceof RootBeanDefinition)
        {
            RootBeanDefinition rootBeanDef = (RootBeanDefinition) beanDef;
            try
            {
                if (rootBeanDef.getBeanClass() != null)
                {
                    return rootBeanDef.getBeanClass();
                }
            }
            catch (IllegalStateException e)
            {
                // do nothing. This gets thrown for factory beans
View Full Code Here

  @Test
  public void supportsBasicConfiguration() {

    RepositoryConfiguration<RepositoryConfigurationSource> configuration = new DefaultRepositoryConfiguration<RepositoryConfigurationSource>(
        source, new RootBeanDefinition("com.acme.MyRepository"));

    assertThat(configuration.getConfigurationSource(), is(source));
    assertThat(configuration.getImplementationBeanName(), is("myRepositoryImpl"));
    assertThat(configuration.getImplementationClassName(), is("MyRepositoryImpl"));
    assertThat(configuration.getRepositoryInterface(), is("com.acme.MyRepository"));
View Full Code Here

      protected BeanWrapper instantiateBean(String beanName, RootBeanDefinition mbd) {
        return beanName.equals("repoFactory") ? new BeanWrapperImpl(factory) : super.instantiateBean(beanName, mbd);
      }
    };

    beanFactory.registerBeanDefinition("postProcessor", new RootBeanDefinition(PredictingProcessor.class));
    beanFactory.registerBeanDefinition("repoFactory", new RootBeanDefinition(RepositoryFactoryBeanSupport.class));

    when(information.getRepositoryInterface()).thenReturn((Class) PersonRepository.class);
    when(information.getDomainType()).thenReturn((Class) Person.class);
    when(information.getIdType()).thenReturn((Class) Serializable.class);
View Full Code Here

  protected void tearDown() throws Exception {
    super.tearDown();
  }
 
  public void testMinimalDefinition() throws Exception {
    RootBeanDefinition beanDefinition = (RootBeanDefinition) this.beanFactory.getBeanDefinition("minimal");
    assertSame(RepositoryFactoryBean.class, beanDefinition.getBeanClass());
    assertPropertyValue(beanDefinition, "configuration", "classpath:config.xml");
  }
View Full Code Here

    assertSame(RepositoryFactoryBean.class, beanDefinition.getBeanClass());
    assertPropertyValue(beanDefinition, "configuration", "classpath:config.xml");
  }

  public void testExtendedDefinition() throws Exception {
    RootBeanDefinition beanDefinition = (RootBeanDefinition) this.beanFactory.getBeanDefinition("extended");
    assertSame(RepositoryFactoryBean.class, (beanDefinition.getBeanClass()));
    assertPropertyValue(beanDefinition, "configuration", "file:config.xml");
    assertPropertyValue(beanDefinition, "homeDir", "file:///homeDir");
  }
View Full Code Here

    assertPropertyValue(beanDefinition, "configuration", "file:config.xml");
    assertPropertyValue(beanDefinition, "homeDir", "file:///homeDir");
  }

  public void testFullDefinition() throws Exception {
    RootBeanDefinition beanDefinition = (RootBeanDefinition) this.beanFactory.getBeanDefinition("full");
    assertSame(RepositoryFactoryBean.class, (beanDefinition.getBeanClass()));
    assertPropertyValue(beanDefinition, "homeDir", "file:///homeDir");
    assertPropertyValue(beanDefinition, "repositoryConfig", "repoCfg");
  }
View Full Code Here

    assertPropertyValue(beanDefinition, "homeDir", "file:///homeDir");
    assertPropertyValue(beanDefinition, "repositoryConfig", "repoCfg");
  }
 
  public void testTransactionManager() throws Exception {
    RootBeanDefinition beanDefinition = (RootBeanDefinition) this.beanFactory.getBeanDefinition("transactionManager");
    assertSame(LocalTransactionManager.class, (beanDefinition.getBeanClass()));
    assertPropertyValue(beanDefinition, "sessionFactory", "jcrSessionFactory");
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.support.RootBeanDefinition

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.