JSF2 @ViewScoped + Spring + Hibernate problem: No session
I'm working on an application that was previously JSF 1.1 compliant but is now in the process of being upgraded to JSF 2.0.
There's a service layer and a DAO layer which is managed by Spring. I merge the contexts such开发者_C百科 that the services can be injected directly into JSF ManagedBeans as ManagedProperties. This seems to work fine so far. The problem shows up when I try to use the new @ViewScoped annotation in JSF2. On any first request to the page with the ViewScope bean things work correctly, but any subsequent postbacks to the page fails with "no session" messages littering my log.
I understand that database sessions should not remain open between http requests but I expected a new session to be opened whenever a service method is called. This seems not to be the case.
UPDATE: All my spring beans are singletons (and state-less).
精彩评论