title: Spring Data Rest Repository with abstract class / inheritance
body: <p>I can't get Spring Data Rest with class inheritance working.</p>
  
  <p>I'd like to have a single JSON Endpoint which handles all my concrete classes.</p>
  
  <h2>Repo:</h2>
  
  <pre><code>public interface AbstractFooRepo extends KeyValueRepository&lt;AbstractFoo, String&gt; {}
  </code></pre>
  
  <h2>Abstract class:</h2>
  
  <pre><code>@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
  @JsonSubTypes({
    @JsonSubTypes.Type(value = MyFoo.class, name = "MY_FOO")
  })
  public abstract class AbstractFoo {
    @Id public String id;
    public String type;
  }
  </code></pre>
  
  <h2>Concrete class:</h2>
  
  <pre><code>public class MyFoo extends AbstractFoo { }
  </code></pre>
  
  <p>Now when calling <code>POST /abstractFoos</code> with <code>{"type":"MY_FOO"}</code>, it tells me: <code>java.lang.IllegalArgumentException: PersistentEntity must not be null!</code>. </p>
  
  <p>This seems to happen, because Spring doesn't know about <code>MyFoo</code>.</p>
  
  <p>Is there some way to tell Spring Data REST about <code>MyFoo</code> without creating a Repository and a REST Endpoint for it?</p>
  
  <p>(I'm using Spring Boot 1.5.1 and Spring Data REST 2.6.0)</p>
  
  <h2>EDIT:</h2>
  
  <p>Application.java:</p>
  
  <pre><code>@SpringBootApplication
  @EnableMapRepositories
  public class Application {
    public static void main(String[] args) {
      SpringApplication.run(DemoApplication.class, args);
    }
  }
  </code></pre>