I am new to Spring/JSF.
I have a controller which is annotated by @Component
which have a @Autowired
class UserClass
which has,
@Scope(value=org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE)
I need to create a new UserClass
instance for each new request so my controller is annotated with @Scope("request")
which works perfectly(Creating new instance for each request) with this annotation.
But it broke the ajax calls in <p:dataTable>
selection, commondLink, <f:setPropertyActionListener...
NOTE : if I change the @Scope("request")
to @ViewScoped
the ajax works but my UserClass
becomes singleton and all the data is shared between the threads.
I googled and got to know we need to either use JSF annotations or Spring but here I am using only Spring annotations.
And I found this, PrimeFaces doesn't work when bean scope is request but couldn't understand.