Example usage for org.springframework.beans.factory.annotation AnnotatedGenericBeanDefinition AnnotatedGenericBeanDefinition

List of usage examples for org.springframework.beans.factory.annotation AnnotatedGenericBeanDefinition AnnotatedGenericBeanDefinition

Introduction

In this page you can find the example usage for org.springframework.beans.factory.annotation AnnotatedGenericBeanDefinition AnnotatedGenericBeanDefinition.

Prototype

public AnnotatedGenericBeanDefinition(AnnotationMetadata metadata) 

Source Link

Document

Create a new AnnotatedGenericBeanDefinition for the given annotation metadata, allowing for ASM-based processing and avoidance of early loading of the bean class.

Usage

From source file:com.avanza.astrix.gs.GsBeanDefinitionRegistryPostProcessorPlugin.java

@Override
public void postProcess(BeanDefinitionRegistry registry) {
    registry.registerBeanDefinition("_astrixClusterInfoHolder",
            new AnnotatedGenericBeanDefinition(ClusterInfoHolder.class));
}

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringScopeMetadadaResolverIT.java

public void testViewScope() {
    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(ViewScopedClass.class);
    AnnotatedBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(annotationMetadata);
    AnnotationScopeMetadataResolver annotationScopeMetadataResolver = new JsfCdiToSpringScopeMetadataResolver();

    ScopeMetadata scopeMetadata = annotationScopeMetadataResolver.resolveScopeMetadata(beanDefinition);

    assertThat(scopeMetadata.getScopeName()).isEqualTo(JsfCdiToSpring.VIEW);
}

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringBeanNameGeneratorIT.java

public void testViewScope() {
    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(ViewScopedClass.class);
    AnnotatedBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(annotationMetadata);

    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();

    AnnotationBeanNameGenerator annotationBeanNameGeneratorannotationScopeMetadataResolver = new JsfCdiToSpringBeanNameGenerator();

    annotationBeanNameGeneratorannotationScopeMetadataResolver.generateBeanName(beanDefinition, registry);

    assertThat(beanDefinition.getScope()).isEqualTo(JsfCdiToSpring.VIEW);
}

From source file:org.smartparam.spring.type.SpringBeanType.java

@Override
protected String encodeValue(Object value) {
    AnnotatedGenericBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(value.getClass());
    return beanNameGenerator.generateBeanName(beanDefinition, registry);
}

From source file:org.smartparam.spring.function.SpringFunctionRepository.java

@Override
protected Function createFunction(String functionName, Method method) {
    AnnotatedGenericBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(
            method.getDeclaringClass());
    String beanName = beanNameGenerator.generateBeanName(beanDefinition, registry);

    SpringFunction springFunction = new SpringFunction(functionName, FUNCTION_TYPE, beanName, method);

    return springFunction;
}

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringScopeMetadadaResolverIT.java

public void testSessionScope() {
    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(SessionScopedClass.class);
    AnnotatedBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(annotationMetadata);
    AnnotationScopeMetadataResolver annotationScopeMetadataResolver = new JsfCdiToSpringScopeMetadataResolver();

    ScopeMetadata scopeMetadata = annotationScopeMetadataResolver.resolveScopeMetadata(beanDefinition);

    assertThat(scopeMetadata.getScopeName()).isEqualTo(JsfCdiToSpring.SESSION);
}

From source file:org.joinfaces.annotations.JsfCdiToSpringApplicationBeanFactoryPostProcessorIT.java

@Test
public void testViewScopedClass() {
    GenericApplicationContext acx = new GenericApplicationContext();
    AnnotationConfigUtils.registerAnnotationConfigProcessors(acx);

    acx.registerBeanDefinition("viewScopedClass",
            new AnnotatedGenericBeanDefinition(new StandardAnnotationMetadata(ViewScopedClass.class)));
    acx.registerBeanDefinition("scopedBeansConfiguration",
            new RootBeanDefinition(ScopedBeansConfiguration.class));
    acx.addBeanFactoryPostProcessor(new JsfCdiToSpringBeanFactoryPostProcessor());
    acx.refresh();// ww  w .java  2 s  . c om

    assertThat(acx.getBeanDefinition("viewScopedClass").getScope()).isEqualTo(JsfCdiToSpring.VIEW);
    assertThat(acx.getBeanDefinition("viewScopedBean").getScope()).isEqualTo(JsfCdiToSpring.VIEW);
}

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringBeanNameGeneratorIT.java

public void testSessionScope() {
    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(SessionScopedClass.class);
    AnnotatedBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(annotationMetadata);

    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();

    AnnotationBeanNameGenerator annotationBeanNameGeneratorannotationScopeMetadataResolver = new JsfCdiToSpringBeanNameGenerator();

    annotationBeanNameGeneratorannotationScopeMetadataResolver.generateBeanName(beanDefinition, registry);

    assertThat(beanDefinition.getScope()).isEqualTo(JsfCdiToSpring.SESSION);
}

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringScopeMetadadaResolverIT.java

public void testNoScope() {
    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(NoScopedClass.class);
    AnnotatedBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(annotationMetadata);
    AnnotationScopeMetadataResolver annotationScopeMetadataResolver = new JsfCdiToSpringScopeMetadataResolver();

    ScopeMetadata scopeMetadata = annotationScopeMetadataResolver.resolveScopeMetadata(beanDefinition);

    assertThat(scopeMetadata.getScopeName()).isEqualTo(JsfCdiToSpring.SINGLETON);
}

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringBeanNameGeneratorIT.java

public void testNoScope() {
    AnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(NoScopedClass.class);
    AnnotatedBeanDefinition beanDefinition = new AnnotatedGenericBeanDefinition(annotationMetadata);

    BeanDefinitionRegistry registry = new SimpleBeanDefinitionRegistry();

    AnnotationBeanNameGenerator annotationBeanNameGeneratorannotationScopeMetadataResolver = new JsfCdiToSpringBeanNameGenerator();

    annotationBeanNameGeneratorannotationScopeMetadataResolver.generateBeanName(beanDefinition, registry);

    assertThat(beanDefinition.getScope()).isEmpty();
}