java 代码技巧 (持续更新)

1、找类、方法、字段上有没有对应的注解

    Component annotation = AnnotationUtils.findAnnotation(AaService.class, Component.class); 

  	ReflectionUtils.doWithMethods(User.class,m->{
          Qualifier a = AnnotationUtils.findAnnotation(m, Qualifier.class);
      });
 
      ReflectionUtils.doWithFields(User.class, f->{
          Qualifier a = AnnotationUtils.findAnnotation(f, Qualifier.class);
      });

你可能感兴趣的:(spring,java,开发语言,java-ee)