Example usage for org.springframework.beans.factory.annotation AnnotatedBeanDefinition setPrimary

List of usage examples for org.springframework.beans.factory.annotation AnnotatedBeanDefinition setPrimary

Introduction

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

Prototype

void setPrimary(boolean primary);

Source Link

Document

Set whether this bean is a primary autowire candidate.

Usage

From source file:org.rosenvold.spring.convention.ConventionBeanFactory.java

static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd) {
    if (abd.getMetadata().isAnnotated(Primary.class.getName())) {
        abd.setPrimary(true);
    }/*from w  ww .j  av  a2  s.  com*/
    if (abd.getMetadata().isAnnotated(Lazy.class.getName())) {
        Boolean value = (Boolean) abd.getMetadata().getAnnotationAttributes(Lazy.class.getName()).get("value");
        abd.setLazyInit(value);
    }
    if (abd.getMetadata().isAnnotated(DependsOn.class.getName())) {
        String[] value = (String[]) abd.getMetadata().getAnnotationAttributes(DependsOn.class.getName())
                .get("value");
        abd.setDependsOn(value);
    }
}