public static void main(String[] args) throws Exception {
// 方法路径
String methodPath = "x.x.x.x.methodA";
// 类加载 方法类
Class<?> clazz = Class.forName(methodPath.substring(0, methodPath.lastIndexOf(".")));
// 获取该类所有的方法
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
//所有方法上的注解
Annotation[] declaredAnnotations = method.getDeclaredAnnotations();
//获取指定注解
DataPermission annotation = method.getAnnotation(DataPermission.class);
System.out.println(Arrays.toString(declaredAnnotations) + ":" + method.getName() + ":" + annotation + ":");
}
}