Foreword: This article has no technical content, but it may be difficult to find the reason when it is not rigorous or for beginners.
First appears: Annotations are not allowed here This prompt is often the scope of annotations is not allowed, for example, annotations that can only affect Method, but are placed inside class or method.
Post a picture:
I didn't notice the semicolon at the beginning, so I poke the source code of the annotation, check its target, it acts on the method, that's right, and the value is an array of Class. Baidu went to no avail, got up and went to the bathroom. When he came back, he took a closer look and found that there was an extra semicolon. In Java, the semicolon can become a statement independently, which means nothing is done, but it is not a function. Therefore, no matter whether the idea is in the code check or when it tries to execute, it will report an error.
Concluding remarks:
If you are also confused because of similar issues, please follow the above ideas to take a look. Is it annotating the scope of action, or passing a value, or just adding a semicolon to check. ending...