title: Spring not autowiring field in a class with constructor
body: <p>I've read questions here in stackoverflow such as:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/14234676/how-to-autowire-bean-with-constructor">Anyway to @Autowire a bean that requires constructor arguments?</a></li>
  <li><a href="https://stackoverflow.com/questions/6739566/anyway-to-autowire-a-bean-that-requires-constructor-arguments">How to @Autowire bean with constructor</a></li>
  </ul>
  
  <p>I've also read links provided in these questions such as <a href="http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-autowired-annotation-qualifiers" rel="nofollow noreferrer">3.9.3 Fine-tuning annotation-based autowiring with qualifiers</a> but nothing that I tried worked.</p>
  
  <p>Here's my class:</p>
  
  <pre><code>public class UmbrellaRestClient implements UmbrellaClient {
  
      private static final Logger LOGGER = LoggerFactory.getLogger(UmbrellaRestClient.class);
      private static final Map&lt;String, String&gt; PARAMETROS_INFRA_UMBRELLA = ApplicationContextProvider.getApplicationContext().getBean(ParametrosInfraComponent.class)
              .findByIdParametroLikeAsMap("%UMBRELLA%");
  
      private final HttpConnectionRest conexaoHttp;
  
      @Autowired
      @Qualifier
      private TemplateLoaderImpl templateLoader;
  
      public UmbrellaRestClient(final String url) {
          this.conexaoHttp = new HttpConnectionRest(UmbrellaRestClient.PARAMETROS_INFRA_UMBRELLA.get("UMBRELLA_HOST") + url, "POST", true);
      }
  
      /**
       * {@inheritDoc}
       */
      @Override
      public String enviarNfe(final String cnpjFilial, final String idPedido, final BigDecimal valorGNRE, final String arquivoNfe) {
          if (StringUtils.isBlank(arquivoNfe)) {
              throw new ClientException("Arquivo de NF-e não carregado.");
          }
  
          final String usuario = StringUtils.defaultIfBlank(UmbrellaRestClient.PARAMETROS_INFRA_UMBRELLA.get("USUARIO_UMBRELLA"), "WS.INTEGRADOR");
  
          Map&lt;String, String&gt; parametrosTemplate = new HashMap&lt;&gt;(6);
          parametrosTemplate.put("usuario", usuario);
          parametrosTemplate.put("senha", StringUtils.defaultIfBlank(UmbrellaRestClient.PARAMETROS_INFRA_UMBRELLA.get("SENHA_UMBRELLA"), "WS.INTEGRADOR"));
          parametrosTemplate.put("valorGNRE", valorGNRE.toPlainString());
          parametrosTemplate.put("idPedido", idPedido);
          parametrosTemplate.put("cnpjFilial", cnpjFilial);
          parametrosTemplate.put("arquivoNfe", arquivoNfe);
  
          final String xmlRequisicao = ConverterUtils.retornarXMLNormalizado(this.templateLoader.preencherTemplate(TemplateType.ENVIO_XML_NFE, parametrosTemplate));
  
          this.conexaoHttp.setXmlEnvio(xmlRequisicao);
  
          UmbrellaRestClient.LOGGER.info("XML ENVIO #####################: {}", xmlRequisicao);
  
          return this.conexaoHttp.enviarXML();
      }
  }
  </code></pre>
  
  <p>The field templateLoader does not get injected. I tested in other classes that have dependency injection and works. I guess this is happening because I have a constructor that depends on a parameter and this parameter is really passed by each class that needs to use it so I cannot use dependency injection to the parameter of the constructor in applicationContext for example.</p>
  
  <p>What should I do to get field injected?</p>