1. set value object in session
RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
attributes.setAttribute("key", value,
RequestAttributes.SCOPE_SESSION);
2.get object from session
Object mutex = RequestContextHolder.currentRequestAttributes().getSessionMutex();
RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
Object value = null;
synchronized (mutex) {
value = attributes.getAttribute("key",
RequestAttributes.SCOPE_SESSION);
}
RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
attributes.setAttribute("key", value,
RequestAttributes.SCOPE_SESSION);
2.get object from session
Object mutex = RequestContextHolder.currentRequestAttributes().getSessionMutex();
RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
Object value = null;
synchronized (mutex) {
value = attributes.getAttribute("key",
RequestAttributes.SCOPE_SESSION);
}