title: spring boot application with HttpSession : Can not get get session attributes
body: <p>***I am trying to implement session management in spring boot application using HttpSession. when i call a web service through postman client,session attributes are accessible.But while accessing from application,it wont be available.
  This is my login page and i am setting my session attributes here.</p>
  
  <pre><code>@Autowired
  public HttpSession httpSession;
  
   ClsCommon clsCommon=new ClsCommon();
  private final Logger log = Logger.getLogger(this.getClass());
  public static final String ACTIVE_RECORD_STATUS="A";
  public static final String DEACTIVE_RECORD_STATUS="D";
  @Override
  public String userValidate(ClsLoginResourceDto clsLoginDto) {
      List serverList = new ArrayList();
      String result="";
      try{
          List&lt;ClsLoginResourceBean&gt; list=iLoginResourceRepository.userValidate(clsLoginDto.getUserName(), clsLoginDto.getPassword(), ACTIVE_RECORD_STATUS);
  
  
          if(list.size()&gt;0){
              httpSession.setAttribute("COMPANY", list.get(0).getCompanyName());
              httpSession.setAttribute("COMPANYID", list.get(0).getCompanyId());
              httpSession.setAttribute("USERNAME", list.get(0).getUserName());
              httpSession.setAttribute("USERID", list.get(0).getUserId());
              httpSession.setAttribute("USERROLE", list.get(0).getUserRoleName());
              httpSession.setAttribute("USERROLEID", list.get(0).getUserRoleId());
  
              result=clsCommon.convertToJson(list);
          }
          else{
              httpSession.invalidate();
              result="failed";
          }
      }
      catch(Exception e){
          e.printStackTrace();
          result="exception";
      }
      finally{
      }
      return result;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This is my get session part..</p>
  
  <pre><code>@Autowired
  private HttpSession  httpsession;
  @RequestMapping(value = "/server/getData", method = RequestMethod.GET,consumes = "application/json", produces = "application/json")
  public @ResponseBody String getData() {
  
      try{
  
  System.out.println("==server==COMPANYID=="+httpession.getAttribute("COMPANYID"));
      System.out.println("==server==USERID=="+httpession.getAttribute("USERID"));
      }
      catch(Exception e){
          e.printStackTrace();
          log.error("Exception caught  :"+e);
  
      }
      return "success";
  }
  </code></pre>
  
  <p>}
  Please let me know if i m doing any mistakes.I am new to java.please help me.***</p>