Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 849883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:10:24+00:00 2026-05-15T07:10:24+00:00

Because of CDI (and its implementation Weld), every POJO in JEE6 can be annotated

  • 0

Because of CDI (and its implementation Weld), every POJO in JEE6 can be annotated with @Named, which makes the POJO accessible to the view.

Does that mean that ManagedBeans are completely obsolete now?
Or did I miss something where @ManagedBean still makes sense?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T07:10:25+00:00Added an answer on May 15, 2026 at 7:10 am

    In short, @ManagedBean makes sense for applications that use JSF but do not use JSR 299 (whatever the reason is). Below a longer explanation from Gavin King:

    Re: Comparisons to @ManagedBean annotations in JSF2?:

    While looking through the Weld examples, and the older WebBeans
    documentation, it looks like a
    competitor to the new @ManagedBean JSF
    2.0 annotations. Is there any information on when we’d want to use
    one over the other?

    It’s a good question, and I’m not
    really in full agreement with the
    answers that have been posted so far.

    The new EE Managed Beans specification
    defines a base component model for
    Java EE, together with a very basic
    set of container services (@Resource,
    @PostConstruct, @PreDestroy).

    The idea is that other specifications
    (beginning with EJB, CDI, JSF and the
    new Java Interceptors spec) build upon
    this base component model and layer
    additional services, for example
    transaction management, typesafe
    dependency injection, interceptors. So
    at this level, the managed beans, CDI,
    interceptors and EJB specifications
    all work hand-in-hand and are highly
    complementary.

    Now, the Managed Beans specification
    is quite open-ended with respect to
    identifying exactly which classes are
    managed beans. It does provide the
    @ManagedBean annotation as one
    mechanism, but it also allows other
    specifications to define different
    mechanisms. So, for example:

    • The EJB specification says that a class obeying certain programming
      restrictions with a @Stateless or
      @Stateful annotation deployed in an
      EJB jar is a managed bean.

    • The CDI specification says that any class with an appropriate constructor
      deployed in a “bean deployment
      archive” is a managed bean.

    Given that EJB and CDI provide
    arguably more convenient ways to
    identify a managed bean, you might
    wonder precisely what @ManagedBean is
    needed for. The answer, as alluded to
    by Dan, is that if you have CDI
    available in your environment (for
    example, if you are using EE6), then
    @ManagedBean is just not really
    needed. @ManagedBean is really there
    for use by people who are using JSF2
    without CDI
    .

    OTOH, if you do annotate a bean
    @ManagedBean, and you do have CDI in
    your environment, you can still use
    CDI to inject stuff into your bean.
    It’s just that the @ManagedBean
    annotation is not required in this
    case.

    To summarize, if you do have CDI
    available to you, it provides a far
    superior programming model to the
    @ManagedBean/@ManagedProperty model
    that JSF2 inherits from JSF1
    . So
    superior, in fact, that the EE 6 web
    profile does not require support for
    @ManagedProperty etc. The idea being
    that you should just use CDI instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use JSF, Hibernate and CDI with Weld. My application is divided in: View
Because shells other than ksh do not support pass-by-reference, how can multiple arrays be
Because of the way in which YES/NO are defined, you cannot use YES/NO with
Because anyone can sign up and then log in,... and because a user isn't
I know this sounds strange, mixing CDI (Weld) and Spring for the controller. But
Because of all the problems we can meet when trying to use Hibernate in
Here's a recurrent problem that I have and I think maybe CDI events can
Because if it thread safe I can use just one instance of VTDGen for
Because I run a blog aggregator website which checks a large list of RSS
I'm trying junit test with CDI/Weld and JEEUnit. I get this message on startup:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.