Annotation是对是错?

来源:互联网 发布:制作动画的软件 知乎 编辑:程序博客网 时间:2024/04/27 15:39

 还是来看看专家说的话吧!

Bill Burke has written up four simple rules for when to use annotations instead of XML, based on his experience with JBoss’ EJB3 implementation. They are:

  • Use an annotation if the metadata you are applying changes the design of your class.
  • Use an annotation if the metadata changes the design of code interacting with your class.
  • If your application needs to be portable between app-servers or databases, don't use an annotation that will not allow you to be portable.
  • Use XML when you want to configure on a per-deployment basis.

 

 

原创粉丝点击