What is an annotation?
Concepts: Annotations (Annotation), also called Meta data. A description of the code level. It is a feature introduced in JDK1.5 and later versions, with classes, interfaces, and enumerations at the same level. It can be declared in front of packages, classes, fields, methods, local variables, method parameters, and so on, to explain these elements, comments.
Classification of annotations
1. By source
Bring your own annotations to the JDK
@Override means that the current method overrides the parent class
@Deprecation indicates that the method is obsolete, there are horizontal lines on the method, and warnings are used.
@SuppviseWarnings means to turn off some warning messages (notifies the Java compiler to ignore specific compilation warnings)
Third-party common annotations (example)
Spring: @Autowired @service @Repository
MyBatis: @InsertProvider @UpdateProvider @Option
Custom annotations
Meta annotations (annotated annotations)
2. Follow the operating mechanism
SOURCE annotations: Annotations only exist in the source code, compiled into a. class file will not exist.
Compile-time annotations: annotations exist in both the source and. class files, such as @override.
Runtime Annotations: It also works in the run phase, and even affects the annotations that run the logic, such as @autowired
Full parsing of Java annotations