注释VS管理的bean声明faces-config.xml中 [英] Annotations vs managed beans declarations in faces-config.xml

查看:243
本文介绍了注释VS管理的bean声明faces-config.xml中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到我的手在JSF 2.0和对新的基于注释自动装配(托管的bean声明没有faces-config.xml中的任何code)某些疑问。

I'm getting my hands on JSF 2.0 and have certain doubt about new annotation based auto-wiring (declaration of managed beans without any code in faces-config.xml).

至于我的注释是巨大的,容易的,但问题可能会在一定需要在一个大的系统,如果使用了注释,将导致需要删除某些类别的另一个替代的bean(或者类似肮脏的黑客),但它可以很容易固定的面孔,cofig.xml。

As far as I am annotations are great and easy, but problem may come to a certain need of substituting one bean with another in a big system which, if annotations were used, will result in a need to delete certain classes (or similar dirty hack), while it could be easily fixed in faces-cofig.xml.

请,分享您对此事的经验。我应该算是比较方便的,为什么?

Please, share your experience on the matter. What should be considered more convenient and why?

推荐答案

由于在核心的JavaServer说面(第三版)

在JSF 2.0之前,所有的bean必须与XML配置。如今,你有
  注释和XML配置之间的选择。 XML配置是相当
  冗长,但它可以,如果你想在部署时配置豆类是有用的。

Before JSF 2.0, all beans had to be configured with XML. Nowadays, you have the choice between annotations and XML configuration. The XML configuration is rather verbose, but it can be useful if you want to configure beans at deployment time.

注解允许快速发展和减少冗余编码XML。一般地,它极大地取决于项目本身。

Annotations allow rapid development and reduce redundant xml coding. Generally, it greatly depends on the project itself.

这篇关于注释VS管理的bean声明faces-config.xml中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆