1 2 Previous Next 18 Replies Latest reply on Feb 9, 2010 5:40 AM by dan.j.allen Go to original post
      • 15. Re: Help needed with Weld,EJB,JSF
        dan.j.allen

        John Leed wrote on Jan 28, 2010 23:16:


        Is there a purpose behind making the producer class an SLSB?


        In fact, you are correct. I suggested using an EJB session bean out of habit. The producer class does not have to be annotated at all. (It can be a plain old Java bean).


        In the Java EE 5 days, your options for using a resource injection (i.e., @Resource, @PersistenceContext, etc) were to use an EJB session bean or a JSF managed bean. Since we pretty much banished JSF managed beans with Seam, that leaves an EJB session bean. Hence my instinct.


        As of Java EE 6, any CDI bean supports resource injection. The reason is that any CDI bean is a managed bean which in turn is a Java EE component. Java EE components support resource injection.


        To answer the other question in this thread, yes, @javax.annotation.ManagedBean is pretty much useless. It is a formality for how you would make a Java class a managed bean without CDI present. But since CDI is part of Java EE 6, there is really no point in having it.

        • 16. Re: Help needed with Weld,EJB,JSF
          asookazian

          Dan Allen wrote on Feb 04, 2010 20:17:


          To answer the other question in this thread, yes, @javax.annotation.ManagedBean is pretty much useless. It is a formality for how you would make a Java class a managed bean without CDI present. But since CDI is part of Java EE 6, there is really no point in having it.


          So if you're using Spring 3 then you're most likely not using CDI/Weld.  So how does a JSF2/Spring3 app implement/handle managed beans?  Maybe there's a good reason they left it in the EE6 spec?

          • 17. Re: Help needed with Weld,EJB,JSF
            dan.j.allen

            Yes and no. No because Spring 3 will likely standardize on javax.inject.Named to hook JSF to Spring beans via the EL. Yes because Spring doesn't have auto-discovery of bean classes like CDI (That isn't to say they couldn't, I just don't think they offer annotation-less bean classes). So, like I said, the annotation is a formality which inside of Java EE you simply don't need. Outside of Java EE (and outside of CDI), I guess you could justify its existence to establish some sort of common ground.

            • 18. Re: Help needed with Weld,EJB,JSF
              dan.j.allen

              ...to clarify, I don't think they offer annotation-less bean classes without using XML. Of course, Spring has always supported defining beans via XML...its bread and butter so to speak.

              1 2 Previous Next