I am using JSF Mojarra 2.1.13, PrimeFaces 3.5 and Spring 3.2.3 for my application. For DI I am using Spring approach (not CDI). I am following the tutorial on PrimeFaces dem
Not really sure why you configured the @ManagedBean
as a @Component
to begin with. This problem is because Spring handles a single instance of @Component
across your application (or at least that's how it looks from your explanation). Remove it and use @ViewScoped
in your managed bean to make this work as expected. Note that if you use Spring to manage your JSF managed beans, then you have to add this configuration in your faces-config.xml (from mkyong tutorial):
<application>
<el-resolver>
org.springframework.web.jsf.el.SpringBeanFacesELResolver
</el-resolver>
</application>
But doing this you will loss the power of @ViewScoped
managed beans. To solve this error, you have to implement the @ViewScoped
in Spring. There are plenty examples on the net about this, and looks that the most popular is from Cagatay's
More info about JSF managed bean scopes: Communication in JSF 2: Managed bean scopes