@Target注解
声明可以使用的对象
@Target{Elemtype.xxx}
Elemtype 为枚举类
public enum ElementType {
//类接口或者泛型的声明
TYPE,
//域声明
FIELD,
//方法声明
METHOD,
//参数声明
PARAMETER,
//构造器声明
CONSTRUCTOR,
//本地变量声明
LOCAL_VARIABLE,
//声明
ANNOTATION_TYPE,
//包
PACKAGE,
//参数
TYPE_PARAMETER,
//使用
TYPE_USE
}
@Retention注解:注解的存在位置
使用@Retention{RetentionPolicy.xxx}
RententionPolicy枚举类
public enum RetentionPolicy {
/**
* Annotations are to be discarded by the compiler.源文件
*/
SOURCE,
/**
* Annotations are to be recorded in the class file by the compiler
* but need not be retained by the VM at run time. This is the default
* behavior.class文件
*/
CLASS,
/**
* Annotations are to be recorded in the class file by the compiler and
* retained by the VM at run time, so they may be read reflectively. 运行时
*
* @see java.lang.reflect.AnnotatedElement
*/
RUNTIME
}
@Documented 注解会把加该注解的对象加入到javadoc下
@Component 注入到Spring工厂中去
@Aspect Aop的面向切面
@Slf4j 日志文件的注解
@autowried自动注入对象 ,必须再Spring 工厂中注册
@PointCut()
里面可以“@annocation(注解名称)”来声明切入的地方,也可用传统的execute的方式
@Before @around 一个是环绕一个是之前 用execute的方式可以不用单独写@pointcut,否则则是该方法 调用@Around(“xxx”)…xxx为pointcut后的方法