Revert merged support for @ManagedNotification & @ManagedOperationParameter

This commit reverts the recently added merged annotation support for
Spring's JMX annotations by once again using the simpler searches for
repeatable annotations in AnnotationUtils.

Issue: SPR-13973
This commit is contained in:
Sam Brannen
2016-03-29 17:50:54 +02:00
parent eec22f5072
commit 3597879608
2 changed files with 3 additions and 23 deletions

View File

@@ -29,7 +29,6 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.beans.factory.config.EmbeddedValueResolver;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.jmx.export.metadata.InvalidMetadataException;
import org.springframework.jmx.export.metadata.JmxAttributeSource;
@@ -107,7 +106,7 @@ public class AnnotationJmxAttributeSource implements JmxAttributeSource, BeanFac
public org.springframework.jmx.export.metadata.ManagedOperationParameter[] getManagedOperationParameters(Method method)
throws InvalidMetadataException {
Set<ManagedOperationParameter> anns = AnnotatedElementUtils.getMergedRepeatableAnnotations(
Set<ManagedOperationParameter> anns = AnnotationUtils.getRepeatableAnnotations(
method, ManagedOperationParameter.class, ManagedOperationParameters.class);
return copyPropertiesToBeanArray(anns, org.springframework.jmx.export.metadata.ManagedOperationParameter.class);
}
@@ -116,7 +115,7 @@ public class AnnotationJmxAttributeSource implements JmxAttributeSource, BeanFac
public org.springframework.jmx.export.metadata.ManagedNotification[] getManagedNotifications(Class<?> clazz)
throws InvalidMetadataException {
Set<ManagedNotification> anns = AnnotatedElementUtils.getMergedRepeatableAnnotations(
Set<ManagedNotification> anns = AnnotationUtils.getRepeatableAnnotations(
clazz, ManagedNotification.class, ManagedNotifications.class);
return copyPropertiesToBeanArray(anns, org.springframework.jmx.export.metadata.ManagedNotification.class);
}

View File

@@ -16,13 +16,7 @@
package org.springframework.jmx.export.annotation;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.springframework.core.annotation.AliasFor;
import org.springframework.jmx.IJmxTestBean;
import org.springframework.jmx.export.annotation.AnnotationTestBean.MyManagedNotification;
import org.springframework.jmx.support.MetricType;
import org.springframework.stereotype.Service;
@@ -34,7 +28,7 @@ import org.springframework.stereotype.Service;
@ManagedResource(objectName = "bean:name=testBean4", description = "My Managed Bean", log = true,
logFile = "jmx.log", currencyTimeLimit = 15, persistPolicy = "OnUpdate", persistPeriod = 200,
persistLocation = "./foo", persistName = "bar.jmx")
@MyManagedNotification(notificationTypes = { "type.foo", "type.bar" })
@ManagedNotification(name = "My Notification", notificationTypes = { "type.foo", "type.bar" })
public class AnnotationTestBean implements IJmxTestBean {
private String name;
@@ -123,17 +117,4 @@ public class AnnotationTestBean implements IJmxTestBean {
return 3;
}
@ManagedNotification(name = "My Notification", notificationTypes = {})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public static @interface MyManagedNotification {
@AliasFor(annotation = ManagedNotification.class)
String description() default "";
@AliasFor(annotation = ManagedNotification.class)
String[] notificationTypes();
}
}