title: Service not Autowired in JSF Converter
body: <p>I am working on a web application using PrimeFaces, JPA, Hibernate and JSF 2.0.</p>
  
  <p>I have a converter for my JSF <code>p:selectOneMenu</code>. My problem is, when I run my application the Service <code>descriptifService</code> is not autowired, it return <code>NULL</code> !</p>
  
  <p>The converter :</p>
  
  <pre><code>@Component
  @FacesConverter(value = "descriptifConverter")
  public class DescriptifConverter implements Converter {
  
  @Autowired
  @RmiClient
  private IDescriptifService descriptifService;
  
  @Override
  public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
      if (arg2 == null || arg2.isEmpty()) {
          return null;
      }
  
      String descriptif = arg2;
      Long value = Long.valueOf(descriptif);
      DescriptifDto result = new DescriptifDto();
      result = descriptifService.findById(value);
      return result;
  }
  
  @Override
  public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
  
      if(arg2 == null || ((DescriptifDto) arg2).getIdDescriptif() == null) return null;
  
      DescriptifDto descriptif = new DescriptifDto();
  
      if(arg2 instanceof DescriptifDto) {
          descriptif = (DescriptifDto) arg2;
          String idDescriptif = descriptif.getIdDescriptif().toString();
          return (idDescriptif != null) ? String.valueOf(idDescriptif) : null;
      } else throw new ConverterException("Something wrong!" + arg2.hashCode() + arg2.toString());
  
  }
  }
  </code></pre>
  
  <p>The JSF code :</p>
  
  <pre><code>                        &lt;p:selectOneMenu value="#{lotController.selectedDescriptif}"
                              effect="fade"&gt;
                              &lt;f:selectItems value="#{lotController.listDescriptifs}" var="descriptif"
                                  itemLabel="#{descriptif.libelle}" itemValue="#{descriptif}" /&gt;
                                  &lt;f:converter binding="#{descriptifConverter}" /&gt;
                          &lt;/p:selectOneMenu&gt;
  </code></pre>