注解的一些理解

来源:互联网 发布:编程网页怎么加入图片 编辑:程序博客网 时间:2024/06/14 17:17

这篇文章秒懂,Java 注解 (Annotation)你可以这样学详细介绍了注解的概念以及用法。

文章认为注解就是标签,理解得比较深刻。

后来又在另一篇文章Spring Annotation Processing: How It Works中看到同样类似的表述。

One of the things I emphasize when I teach Java classes is the fact that annotations are inert. In other words, they are just markers, potentially with some properties, but with no behavior of their own. So whenever you see an annotation on a piece of Java code, it means that there must be some other Java code somewhere that looks for that annotation and contains the real intelligence to do something useful with it.

所以注解不重要,重要的是处理注解的代码。