还是来看看专家说的话吧!
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.
本文分享了四位简单规则,用以指导开发者在何种情况下应当选择使用注解而非XML来配置JBoss EJB3实现中的元数据。这些规则涵盖了从影响类设计到跨应用服务器或数据库的移植性等不同方面。
1244

被折叠的 条评论
为什么被折叠?



