Java – how to get and set the session attribute correctly for multiple variables in the spring boot controller?

I am writing an application that uses Spring boot security and session management with a JDBC. However, I first designed the app under the impression that the Controller was not a singleton. So my controller class was dynamic even if I had read the documents beforehand, I would have realized that it should not be. Although once hosted on a web server, I realized that I had problems with the user session and that I had to read the documentation to better understand it. So now I'm using session management and I'm trying to get all of my variables out of my controller and into my session information in my JDBC. However, I see my car constantly calling Object name = (Object) session.getAttribute() or session.setAttribute("","") in each method where I placed my variables. I am trying to find the best way to call and send data to my session in JDBC.

FYI: I used as 7 global variables in my controller.

Java method:

@RequestMapping(value = "/edit")
    public ModelAndView editPage(@RequestParam(value = "Appcode", required = false, defaultValue = "Appcode") String appcode,HttpSession session) {
        ModelAndView modelAndView = new ModelAndView();
        allPlants = queryService.serverWork();

        try {
            OTSApplication selected_app = (OTSApplication) session.getAttribute("SELECTED_APP");

            if (rc.ValidateUser(id, selected_app.getSys_id()) != 0 || queryService.isAuditor(id)) { 
                gpSelected = apiRunner.runGPData(selected_app.getGuid());
            } else {

        } catch (Exception e) {
        modelAndView.addObject("id", id);
        modelAndView.addObject("hasAccess", false);

        return modelAndView;

Variables that must be in session

    private APIRunner apiRunner;
    private Set aryServer = new HashSet();
    private List aryTier = new ArrayList();
    private List hmap = new ArrayList();
    public List mqlSelectorList = new ArrayList();
    private String name, system, mqlList, tag1, tag2, mqlSelector, parseInstruc, myObject, id;
    private String queryWithServerAttached, secondQuery;
    private List allPlants = new ArrayList();
    private static final Logger logger = LoggerFactory.getLogger(OTSController.class);

I know there must be a simple or better standard way to contain these variables and objects in a JDBC session. If I have to, I don't mind, but I don't want to declare a new object Object name = (Object) session.getAttribute() whenever I want to use the field. Please let me know of any other means.