chaoshangfei
chaoshangfei

Reputation: 205

Do I need a @LocalBean for @ConversationScoped?

My project is using JSF2.0 and WAS8.0. And I use a @ConversationScoped CDI bean as my page's backing bean. My original annotations for this bean are:

    @Named("myBean")
    @ConversationScoped
    @Stateful

Then when the page is being loaded, I got Property not found error. Seems the ELs are totally not working. Then I added @LocalBean (my backing bean MyBean does implement interface, but there's no @Local annotation on the interface):

    @Named("myBean")
    @LocalBean
    @ConversationScoped
    @Stateful

Then everything works nicely. Is it something specific in WebSphere? Or a common requirement for CDI ( I think I have seen some examples with neither @LocalBean nor implementing a @Local annotated interface.

Upvotes: 0

Views: 285

Answers (1)

covener
covener

Reputation: 17896

Seems necessary to me, maybe the other beans you saw were not EJB beans:

The unrestricted set of bean types for a session bean contains all local interfaces of the bean and their superinterfaces. If the session bean has a bean class local view, the unrestricted set of bean types contains the bean class and all superclasses. In addition, java.lang.Object is a bean type of every session bean.

Remote interfaces are not included in the set of bean types.

Upvotes: 1

Related Questions