1 Reply Latest reply on Nov 18, 2009 5:56 AM by Gavin King

    managed beans

    Arbi Sookazian Master

      from weld ref doc:



      A managed bean is a Java class. The basic lifecycle and semantics of a managed bean are defined by the Managed Beans specification.

      Plz define semantics in this context.  I've seen this word hundreds of times but not sure exactly what it means (guessing: meaning or rules or relationships or symbols?)


      If a Java class meets the requirements to be a Managed bean, but I don't want it to be a managed bean for some stupid reason, how do I configure/annotate that?  Or is there not a concept of an unmanaged bean in CDI?


      And which JSR is the managed beans spec?


      btw, Managed beans support the @PostConstruct and @PreDestroy lifecycle callbacks. this seems vaguely familiar to Seam POJOs...


      do managed beans have any advantages over session beans??



      Message-driven and entity beans are by nature non-contextual objects and may not be injected
      into other objects.

      so entity beans in this context refers to JPA entity classes, correct?  I thought we could inject entity classes into other Seam components as long as they were marked with @Name at the type level.  Or maybe I'm wrong, maybe that made them referencable from JSF EL expressions...


      Isn't a regular DTO JavaBean non-contextual?  So we can't inject a DAO JavaBean into another managed bean in Weld??


        • 1. Re: managed beans
          Gavin King Master

          Plz define semantics in this context. I've seen this word hundreds of times but not sure exactly what it means (guessing: meaning or rules or relationships or symbols?)

          It's meaning. What it represents.



          If a Java class meets the requirements to be a Managed bean, but I don't want it to be a managed bean for some stupid reason, how do I configure/annotate that? Or is there not a concept of an unmanaged bean in CDI?

          Use new.



          do managed beans have any advantages over session beans??

          They have less programming restrictions and a simpler lifeycle.