What's the point of package annotations?

前端 未结 6 2081
慢半拍i
慢半拍i 2020-12-08 13:35

I understand the purpose of class annotations, thanks to How and where are Annotations used in Java?. What is the purpose of package annotations, as described in this blog p

6条回答
  •  时光取名叫无心
    2020-12-08 14:02

    1. bnd tool (and maven-bundle-plugin) makes use of package annotations. Putting @Version and @Export annotation in package-info.java allows it to generate OSGi metadata.
    2. javadoc uses package annotations.
    3. JAXB uses package-level annotations, for example, to specify mapping of a Java type to XML Schema type package-wide. Package annotations are also used in JBoss's xml binding.
    4. Struts 2 Convention plugin uses an annotation to specify a default interceptor for all actions in a package.
    5. There are some package-level Hibernate Annotations. An example of those annotations' usage can be found here.

提交回复
热议问题