Example usage for org.springframework.core.type StandardAnnotationMetadata getAnnotationAttributes

List of usage examples for org.springframework.core.type StandardAnnotationMetadata getAnnotationAttributes

Introduction

In this page you can find the example usage for org.springframework.core.type StandardAnnotationMetadata getAnnotationAttributes.

Prototype

@Nullable
default Map<String, Object> getAnnotationAttributes(String annotationName) 

Source Link

Document

Retrieve the attributes of the annotation of the given type, if any (i.e.

Usage

From source file:org.appcomponents.platform.test.loader.PlatformContextLoader.java

@SuppressWarnings("unchecked")
@Override/*from w  w w .j  av a2  s.c  o m*/
protected SpringApplication getSpringApplication() {
    StandardAnnotationMetadata annotationMetadata = new StandardAnnotationMetadata(this.config.getTestClass());
    Map<String, Object> annotationAttributes = annotationMetadata
            .getAnnotationAttributes(PlatformTest.class.getName());
    Assert.notNull(annotationAttributes, "No PlatformTest is specified");

    Class<? extends PlatformFactory> platformFactoryClass = (Class<? extends PlatformFactory>) annotationAttributes
            .get("platformFactory");
    PlatformFactory platformFactory = BeanUtils.instantiate(platformFactoryClass);
    return platformFactory.build();
}