This is a specific servlet container, which in this case is Tomcat. A servlet container is one that manages sessions and provides sessions. Therefore, JSF and Spring have nothing to do here. They simply transparently retrieve it from the servlet container on request.getSession() , etc.
In Tomcat, you can provide a custom session manager implementation in the webapp Context :
<Context ...> <Manager className="com.example.SessionManager">
.. where com.example.SessionManager implements org.apache.catalina.Manager in accordance with its contract. In this case, you can write code to return the sessions to the database.
However, there are alternatives for your specific requirement, you can choose for Tomcat built-in clustering / replication session functions instead of inventing it with a custommade manager / database. Read more about this at Tomcat Clustering / Session Replication HOW-TO .
source share