Spring Boot程序员Java开发

Spring Boot从入门到精通-注解详解

2019-01-16  本文已影响13人  我的小熊不见了

说起注解,就不得不说到三个最基本的注解:

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,

    /**
     * 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:Documented注解表明这个注释是由 javadoc记录的。
以上是三个公共注解,基本上所有的注解都会继承这三个注解。

接下来是Spring Boot中常用的一些注解。

以上是我们常用的一些注解的含义,当然我们也可以自定义注解。

上一篇 下一篇

猜你喜欢

热点阅读