java重复注解

1. 应用场景

基于注解功能的多功能适配
@GetMapping(“/hello”)
@PostMapping(“/hello1”)

2. 开发步骤

  1. 定义注解
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
#### 指定重复注解的list对象
@Repeatable(HList.class)
public @interface H {
    String value();
}

2. `注解list对象的定义
`
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface HList {
#### 指定采集重复注解的集合对象
    H[] value();
}
3 获取 

```java
ReflectionUtils.doWithLocalMethods(Lcpol.class, new ReflectionUtils.MethodCallback() {
            @Override
            public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
                HList hList = method.getAnnotation(HList.class);
                if(hList!=null){
                    for (H h : hList.value()) {
                        System.out.println(h.value());
                    }
                }
            }
        });