I have a web application in java, spring framework, hibernate on tomcat, which has practically no security except login and logout functions (without spring)
I can access user information in the controller:
// where request is HttpServletRequest
HttpSession session = request.getSession (true);
SystemUser user = (SystemUser) session.getAttribute ("user");
and follow the logic. However, I need to get this information at the Dao level. Where I really get data from a database to get user-specific data. One way is to transfer the "user" object to the service level, and then the service layer to transfer it to the dao level. But this is a fairly large amount of work.
I wonder if there is a way in spring how to access the session object in the Dao layer? or any other way to get user data.
source
share