zoukankan      html  css  js  c++  java
  • Spring注解之@Retention

    作用是定义被它所注解的注解保留多久,一共有三种策略,定义在RetentionPolicy枚举中:

    package java.lang.annotation;
    /**
     * Annotation retention policy.  The constants of this enumerated type
     * describe the various policies for retaining annotations.  They are used
     * in conjunction with the {@link Retention} meta-annotation type to specify
     * how long annotations are to be retained.
     *
     * @author  Joshua Bloch
     * @since 1.5
     */
    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文件;但是不被VM运行时保留
    */ 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 }
  • 相关阅读:
    我不为人人,人人不为我
    sed 小结
    linux 之 压缩 / 解压
    java arraylist的问题
    flex swf和movieclip之前的微妙关系
    Flex contextMenu
    。。
    数据库
    flex Vector
    浮动ip
  • 原文地址:https://www.cnblogs.com/liaojie970/p/9138955.html
Copyright © 2011-2022 走看看