SpringBoot中带的工具类

发布时间 2023-06-09 15:36:50作者: 做时间的好朋友

1.AopUtils

Aop工具类

Object bean;
Class<?> beanClass = AopUtils.getTargetClass(bean);
//  获取bean对象的class文件,自动过滤cglib动态代理的代理类

2.AnnotitionUtils

注解工具类

Method method;
Listener listenerAnnotation = AnnotationUtils.findAnnotation(method,Listener.class);

3.方法的参数类型获取

Method method;
Class<?>[] parameterTypes = method.getParameterTypes();
Type[] genericParameterTypes = method.getGenericParameterTypes();