'Code equivalent from JSF to Spring Boot or Java

I am building an application in Spring Boot and Thymeleaf that is already built in JSF (Java Server Faces). I have a part of the app in JSF that takes a values from the header. This is the code:

operator = FacesContext.getCurrentInstance().getExternalContext()
        .getRequestHeaderMap().get("user");

I would like to do the same in Spring Boot. I have already tried with @RequestHeader("user") in the Controller but I get an error saying that it cannot find this header values. Can someone translate the code from JSF to Spring Boot code or something in Java that will work ? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source