title: Spring Dependency Injection not working in singleton class
body: <p>i did a singleton class named AcessoCliente</p>
  <pre><code>public class AcessoCliente {
  
      private HashMap&lt;String, Cliente&gt; clientes;
      private new HashMap&lt;String, Date&gt; clientesNaoEncontrados;
  
      private static AcessoCliente instance;
  
      static {
          instance = new AcessoCliente();
      }
  
      public static AcessoCliente get() {
          return instance;
      }
  
      private AcessoCliente() {
          clientes = new HashMap&lt;String, Cliente&gt;();
          clientesNaoEncontrados = new HashMap&lt;String, Date&gt;();
      }
  
      /*business*/
  }
  </code></pre>
  <p>But i need to do a dependency injection of a class named ValidadorNivelDeAcessoBusiness on my singleton class</p>
  <pre><code>@Component
  public class ValidadorNivelDeAcessoBusiness {
  
      @Autowired
      QuerysNiveisDeAcesso querysNiveisDeAcesso;
      /*business*/
  }
  </code></pre>
  <p>I'm trying do this dependency injection but isn't working, This is what I did:</p>
  <pre><code>public class AcessoCliente {
  
      @Autowired
      ValidadorNivelDeAcessoBusiness validadorNivelDeAcessoBusiness;
  
      private HashMap&lt;String, Cliente&gt; clientes;
      private new HashMap&lt;String, Date&gt; clientesNaoEncontrados;
  
      private static AcessoCliente instance;
  
      static {
          ApplicationContext context = new AnnotationConfigApplicationContext(AcessoCliente.class);
          instance = context.getBean(AcessoCliente.class);
      }
  
      public static AcessoCliente get() {
          return instance;
      }
  
      private AcessoCliente() {
          clientes = new HashMap&lt;String, Cliente&gt;();
          clientesNaoEncontrados = new HashMap&lt;String, Date&gt;();
      }
  
      /*business*/
  }
  </code></pre>
  <p>but the dependency injection isn't working and I get this error:</p>
  <blockquote>
  <p>Error creating bean with name 'acessoCliente': Unsatisfied dependency expressed through field 'validadorNivelDeAcessoBusiness'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'my.project.business.interceptorBusiness.ValidadorNivelDeAcessoBusiness' available: expected at least 1 bean which qualifies as autowire candidate.<br />
  Dependency annotations:<br />
  {@org.springframework.beans.factory.annotation.Autowired(required=true)}</p>
  </blockquote>
  <p>Edit1. That's the QuerysNiveisDeAcesso class</p>
  <pre><code>@Component
  public class QuerysNiveisDeAcesso extends QuerysClientes {
  
      public QueryIntegratorBuilder queryBuscaNiveisDeAcesso(String[] condicoesQuery) throws Exception {
          return super.executaQuery(&quot;BUSCA_NIVEIS_DE_ACESSO&quot;, condicoesQuery);
      }
  
      public QueryIntegratorBuilder queryBuscaNiveisDeAcesso() throws Exception {
          return super.executaQuery(&quot;BUSCA_NIVEIS_DE_ACESSO&quot;);
      }
  
      public QueryIntegratorBuilder queryBuscaNiveisDeAcesso(String sqlWhere, String[] condicoesQuery) throws Exception {
          return super.executaQuery(&quot;BUSCA_NIVEIS_DE_ACESSO&quot;, condicoesQuery, sqlWhere);
      }
  
  }
  </code></pre>