title: Spring Data DomainClassConverter not working (in combination with Java Config)
body: <p>I'm trying to setup the Spring Data/JPA DomainClassConverter to automatically convert (String) id's to the domain classes itself.</p>
  
  <p>My project is uses Java Config (so no xml).</p>
  
  <p>In my WebConfig I have currently:</p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  public class WebConfig extends WebMvcConfigurerAdapter {
  
      @Override
      public void addFormatters(FormatterRegistry registry) {
          registry.addConverter(new DomainClassConverter&lt;DefaultFormattingConversionService&gt;((DefaultFormattingConversionService) registry));
      }
  }
  </code></pre>
  
  <p>This seems to hook up the DomainClassConverter successfully as I can see it inside the conversion service when printing that:</p>
  
  <pre><code>ConversionService converters =
    ..&lt;default converters&gt;..
    org.springframework.data.repository.support.DomainClassConverter@6ea4ce0d, org.springframework.core.convert.support.IdToEntityConverter@5d3f03b, org.springframework.core.convert.support.ObjectToObjectConverter@1d40b47a
  </code></pre>
  
  <p>But when submitting a nested form (Order with Customer ref) the Customer is not converted automatically and hence I get a:</p>
  
  <pre><code>Failed to convert property value of type java.lang.String to required type org.mycomp.domain.Customer for property customer; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.mycomp.domain.Customer] for property customer: no matching editors or conversion strategy found
  </code></pre>
  
  <p>I'm wondering if I'm doing something wrong here?</p>