public class User implements Serializable {}
When a client accesses a resource that can turn on a session, the Web server creates a HttpSession object corresponding to that client, and each HttpSession object consumes some memory space. If there is a lot of users accessing the site at a certain time, the Web server memory will accumulate a large number of HttpSession objects, consuming a lot of server memory, even if the user has left or closed the browser, the Web server still retains its corresponding HttpSession object, The Web server memory resource has been occupied until they time out.
The Web server typically transfers HttpSession objects that are temporarily inactive but not timed out to the file system or database, and the server uses them to load them from the file system or database into memory, a technique called session persistence.
Saving the HttpSession object to a file system or database requires that each Property object in the HttpSession object be serialized to be saved to the file system or database, and the HttpSession object is loaded from the file system or database, such as memory, Each Property object in the HttpSession object needs to be restored in a deserialized manner. Therefore, each Property object stored in the HttpSession object must implement the Serializable interface
Why are Java entity classes implementing serialization