参考链接:https://www.jianshu.com/p/a848655d478e
备注:带参数的方法改如何获取注解:
ResponseEntity queryList(Integer pageNum, Integer pageSize, Map<String, String> map);
public static void main(String[] args) { try { //类注解 Method foo = BrandsPointsPoolResource.class.getMethod("queryList",Integer.class,Integer.class,Map.class); System.out.println(Arrays.toString(foo.getAnnotations())); } catch (NoSuchMethodException e) { e.printStackTrace(); } }