When are Java annotations executed?

后端 未结 7 1950
执念已碎
执念已碎 2021-02-06 04:12

I am just looking to write some annotation which can execute at runtime, before or immediately after a service method is invoked.

I don\'t know if they are executed at r

7条回答
  •  时光说笑
    2021-02-06 04:54

    Annotations don't have effect on your code, they're here to provide information to be evaluated by the compiler or other tools.

    Annotations have a number of uses, among them:

    Information for the compiler — Annotations can be used by the compiler to detect errors or suppress warnings.

    Compiler-time and deployment-time processing — Software tools can process annotation information to generate code, XML files, and so forth.

    Runtime processing — Some annotations are available to be examined at runtime.

    See this page.

提交回复
热议问题