title: Autowired Spring NullPointerException
body: <p>I have a problem with my code trying to generate @Autowired.</p>
  
  <p>The Class:</p>
  
  <pre><code>public class ConsultasMDMWSClientImpl implements ConsultasMDMWSClient {
  
      @Autowired
      ConsultasMDMWSPortype consultasMDMWSPortype;
      public ConsultarClienteResponseMDM consultarClienteEnMdm(ConsultarClienteRequest clienteReq) {
  
         ConsultarClienteResponseMDM response = new ConsultarClienteResponseMDM();
         ConsultasMDMWSService consultasMDMWSService = new ConsultasMDMWSService();
  
         ConsultarClienteResponse clienteResp = null;
         clienteResp = consultasMDMWSPortype.consultarCliente(clienteReq);
         ListaCursoresMDM listaCursores;
              listaCursores = new ObjectMapper().readValue(clienteResp.getListaCursoresResponse(), ListaCursoresMDM.class);
  
         response.getListaCursoresResponse().add(listaCursores);
      return response;
      }
   }
  </code></pre>
  
  <p>My applicationContext.xml</p>
  
  <pre><code>      &lt;context:annotation-config/&gt;
        &lt;context:component-scan base-package="pe.com.claro.eai.esb.ws.jira.mdm"/&gt;
        &lt;import resource="wsclients-config.xml"/&gt;
  </code></pre>
  
  <p>My wsclients-config.xml</p>
  
  <pre><code> &lt;bean id="consultasMDMWSPortype" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean"&gt;
             &lt;property name="serviceInterface" value="pe.com.claro.eai.consultasmdmws.ConsultasMDMWSPortype"/&gt;    
             &lt;property name="wsdlDocumentUrl" value="http://limdeseaiv28.tim.com.pe:8909/ConsultasMDMWS/ConsultasMDMPortSB11?wsdl"/&gt;
             &lt;property name="namespaceUri" value="http://eai.claro.com.pe/ConsultasMDMWS"/&gt;
             &lt;property name="serviceName" value="ConsultasMDMWSService"/&gt;
             &lt;property name="portName" value="ConsultasMDMPortSB11"/&gt;
             &lt;property name="lookupServiceOnStartup" value="false"/&gt;
        &lt;/bean&gt;
  
          &lt;bean id="consultasMDMWSClient"
              class="pe.com.claro.eai.esb.ws.jira.mdm.service.client.ConsultasMDMWSClientImpl"&gt;
                  &lt;property name="consultasMDMWSPortype" ref="consultasMDMWSPortype"/&gt;
         &lt;/bean&gt; 
  </code></pre>
  
  <p>I don't know what I'm doing wrong, I've mapped everything like an example of my work
  I'm new on Spring, my web method works without Spring.</p>
  
  <p>The error just appear when I use @Autowired. </p>
  
  <pre><code>java.lang.NullPointerException
  </code></pre>
  
  <p>Thaks everyone.</p>