Examples of AnnotatedGenericBeanDefinition


Examples of org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition

  private void registerOn(BeanDefinitionRegistry registry, Class<?> type) {
    registerOn(registry, type, false);
  }

  private void registerOn(BeanDefinitionRegistry registry, Class<?> type, boolean customComponent) {
    AnnotatedGenericBeanDefinition definition = new AnnotatedGenericBeanDefinition(type);
    definition.setLazyInit(true);
    definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_NO);
    if (customComponent) {
      definition.setPrimary(true);
      definition.setRole(BeanDefinition.ROLE_APPLICATION);
    } else {
      definition.setPrimary(false);
      definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
    }

    String name = beanNameGenerator.generateBeanName(definition, registry);
    BeanDefinitionHolder definitionHolder = new BeanDefinitionHolder(definition, name);
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition

  private void registerOn(BeanDefinitionRegistry registry, Class<?> type) {
    registerOn(registry, type, false);
  }

  private void registerOn(BeanDefinitionRegistry registry, Class<?> type, boolean customComponent) {
    AnnotatedGenericBeanDefinition definition = new AnnotatedGenericBeanDefinition(type);
    definition.setLazyInit(true);
    definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_NO);
    if (customComponent) {
      definition.setPrimary(true);
      definition.setRole(BeanDefinition.ROLE_APPLICATION);
    } else {
      definition.setPrimary(false);
      definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
    }

    String name = beanNameGenerator.generateBeanName(definition, registry);
    BeanDefinitionHolder definitionHolder = new BeanDefinitionHolder(definition, name);
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition

    this.beanFactory = configurableListableBeanFactory;
    this.container = container;
  }

  private void registerOn(Class<?> type, boolean customComponent) {
    AnnotatedGenericBeanDefinition definition = new AnnotatedGenericBeanDefinition(type);
    definition.setLazyInit(true);
    definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_NO);
    if (customComponent) {
      definition.setPrimary(true);
      definition.setRole(BeanDefinition.ROLE_APPLICATION);
    } else {
      definition.setPrimary(false);
      definition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
    }

    String name = beanNameGenerator.generateBeanName(definition, (BeanDefinitionRegistry) beanFactory);
    BeanDefinitionHolder definitionHolder = new BeanDefinitionHolder(definition, name);
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition

  Assert.assertEquals(BeanDefinition.SCOPE_SINGLETON, scopeMetadata.getScopeName());
  }

  private ScopeMetadata readScopeMetadata(Class<?> componentType) {
  VRaptorScopeResolver resolver = new VRaptorScopeResolver();
  AnnotatedGenericBeanDefinition definition = new AnnotatedGenericBeanDefinition(componentType);
  return resolver.resolveScopeMetadata(definition);
  }
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition

  }


  @Test
  public void testThatResolveScopeMetadataDoesNotApplyScopedProxyModeToASingleton() {
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithSingletonScope.class);
    ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
    assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
    assertEquals(BeanDefinition.SCOPE_SINGLETON, scopeMetadata.getScopeName());
    assertEquals(ScopedProxyMode.NO, scopeMetadata.getScopedProxyMode());
  }
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition

  }

  @Test
  public void testThatResolveScopeMetadataDoesApplyScopedProxyModeToAPrototype() {
    this.scopeMetadataResolver = new AnnotationScopeMetadataResolver(ScopedProxyMode.INTERFACES);
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithPrototypeScope.class);
    ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
    assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
    assertEquals(BeanDefinition.SCOPE_PROTOTYPE, scopeMetadata.getScopeName());
    assertEquals(ScopedProxyMode.INTERFACES, scopeMetadata.getScopedProxyMode());
  }
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition

  }

  @Test
  public void testThatResolveScopeMetadataDoesReadScopedProxyModeFromTheAnnotation() {
    this.scopeMetadataResolver = new AnnotationScopeMetadataResolver();
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithScopedProxy.class);
    ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
    assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
    assertEquals("request", scopeMetadata.getScopeName());
    assertEquals(ScopedProxyMode.TARGET_CLASS, scopeMetadata.getScopedProxyMode());
  }
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition

    assertEquals(ScopedProxyMode.TARGET_CLASS, scopeMetadata.getScopedProxyMode());
  }

  @Test
  public void testCustomRequestScope() {
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithCustomRequestScope.class);
    ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
    assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
    assertEquals("request", scopeMetadata.getScopeName());
    assertEquals(ScopedProxyMode.NO, scopeMetadata.getScopedProxyMode());
  }
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition

  @Test
  public void testCustomRequestScopeViaAsm() throws IOException {
    MetadataReaderFactory readerFactory = new SimpleMetadataReaderFactory();
    MetadataReader reader = readerFactory.getMetadataReader(AnnotatedWithCustomRequestScope.class.getName());
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(reader.getAnnotationMetadata());
    ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
    assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
    assertEquals("request", scopeMetadata.getScopeName());
    assertEquals(ScopedProxyMode.NO, scopeMetadata.getScopedProxyMode());
  }
View Full Code Here

Examples of org.springframework.beans.factory.annotation.AnnotatedGenericBeanDefinition

    assertEquals(ScopedProxyMode.NO, scopeMetadata.getScopedProxyMode());
  }

  @Test
  public void testCustomRequestScopeWithAttribute() {
    AnnotatedBeanDefinition bd = new AnnotatedGenericBeanDefinition(AnnotatedWithCustomRequestScopeWithAttribute.class);
    ScopeMetadata scopeMetadata = this.scopeMetadataResolver.resolveScopeMetadata(bd);
    assertNotNull("resolveScopeMetadata(..) must *never* return null.", scopeMetadata);
    assertEquals("request", scopeMetadata.getScopeName());
    assertEquals(ScopedProxyMode.TARGET_CLASS, scopeMetadata.getScopedProxyMode());
  }
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.