Example usage for org.springframework.beans.factory InjectionPoint getAnnotations

List of usage examples for org.springframework.beans.factory InjectionPoint getAnnotations

Introduction

In this page you can find the example usage for org.springframework.beans.factory InjectionPoint getAnnotations.

Prototype

public Annotation[] getAnnotations() 

Source Link

Document

Obtain the annotations associated with the wrapped field or method/constructor parameter.

Usage

From source file:org.zalando.failsafeactuator.config.FailsafeInjectionConfiguration.java

@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public CircuitBreaker circuitBreaker(InjectionPoint ip) {
    FailsafeBreaker annotation = null;/*from  w  w  w . j  av a 2  s  .  c  o m*/
    for (Annotation a : ip.getAnnotations()) {
        if (a instanceof FailsafeBreaker) {
            annotation = (FailsafeBreaker) a;
            break;
        }
    }
    return circuitBreakerRegistry.getOrCreate(annotation.value());
}