When are Java annotations executed?

后端 未结 7 1982
执念已碎
执念已碎 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 05:11

    Annotations don't execute; they're notes or markers that are read by various tools. Some are read by your compiler, like @Override; others are embedded in the class files and read by tools like Hibernate at runtime. But they don't do anything themselves.

    You might be thinking of assertions instead, which can be used to validate pre and post conditions.

    0 讨论(0)
提交回复
热议问题