title: Spring - inject value for request header name
body: <p>There is a problem with Spring and injecting request header name value into controller.<br>
  Here is the code:</p>
  
  <pre><code>@Controller
  public class ApiController {
  
      @Value("${param.header_name}")
      private String param;
  
      @RequestMapping(value = "/**")
      public void handleApiRequest(final HttpServletRequest request, final HttpServletResponse response,
          @RequestHeader(value = param) final String param)
  </code></pre>
  
  <p>Properties are defined using <strong><code>@PropertySource</code></strong> and <strong><code>PropertySourcesPlaceholderConfigurer</code></strong>.</p>
  
  <p>The problem is:  </p>
  
  <blockquote>
    <p>"The value for annotation attribute RequestHeader.value must be a
    constant expression."</p>
  </blockquote>
  
  <p>But it is not possible to inject a value to a constant (final static) field. Is there a workaround for this? I would like to use <code>RequestHeader</code> annotation / mapping and property file to define the header name.</p>