List of usage examples for org.springframework.core.annotation AnnotatedElementUtils findMergedAnnotationAttributes
@Nullable public static AnnotationAttributes findMergedAnnotationAttributes(AnnotatedElement element, String annotationName, boolean classValuesAsString, boolean nestedAnnotationsAsMap)
From source file:org.springframework.boot.actuate.endpoint.annotation.AnnotationEndpointDiscoverer.java
private DiscoveredEndpoint createEndpoint(Object target, Class<?> endpointType) { AnnotationAttributes annotationAttributes = AnnotatedElementUtils .findMergedAnnotationAttributes(endpointType, Endpoint.class, true, true); String id = annotationAttributes.getString("id"); Assert.state(StringUtils.hasText(id), "No @Endpoint id attribute specified for " + endpointType.getName()); boolean enabledByDefault = (Boolean) annotationAttributes.get("enableByDefault"); Collection<T> operations = this.operationsFactory.createOperations(id, target, endpointType).values(); EndpointInfo<T> endpointInfo = new EndpointInfo<>(id, enabledByDefault, operations); boolean exposed = isEndpointExposed(endpointType, endpointInfo); return new DiscoveredEndpoint(endpointType, endpointInfo, exposed); }
From source file:org.springframework.test.context.BootstrapUtils.java
private static Class<?> resolveDefaultTestContextBootstrapper(Class<?> testClass) throws Exception { ClassLoader classLoader = BootstrapUtils.class.getClassLoader(); AnnotationAttributes attributes = AnnotatedElementUtils.findMergedAnnotationAttributes(testClass, WEB_APP_CONFIGURATION_ANNOTATION_CLASS_NAME, false, false); if (attributes != null) { return ClassUtils.forName(DEFAULT_WEB_TEST_CONTEXT_BOOTSTRAPPER_CLASS_NAME, classLoader); }//from w ww.j av a2s . c o m return ClassUtils.forName(DEFAULT_TEST_CONTEXT_BOOTSTRAPPER_CLASS_NAME, classLoader); }