title: How to mix Spring Data Repositories and Spring Rest Controllers
body: <p>Currently I am exposing a few Spring Data Repositories as RESTful services by annotating them with @RepositoryRestResource like this:</p>
  
  <pre><code>@RepositoryRestResource(collectionResourceRel = "thing1", path = "thing1")
  public interface Thing1Repository extends PagingAndSortingRepository&lt;Thing1, String&gt; {}
  
  @RepositoryRestResource(collectionResourceRel = "thing2", path = "thing2")
  public interface Thing2Repository extends CrudRepository&lt;Thing2, String&gt; {}
  </code></pre>
  
  <p>This all works great. When you hit my first endpoint is also shows all the Spring Data Repositories I have exposed, like this:</p>
  
  <pre><code>{
     _links: {
        thing1: {
           href: "http://localhost:8080/thing1{?page,size,sort}",
           templated: true
        },
        thing2: {
           href: "http://localhost:8080/thing2"
        }
     }
  }
  </code></pre>
  
  <p>Now I have some endpoints I want to expose that cannot be represented by Spring Data Repositories, so I am using a RestController.</p>
  
  <p>Here is a simple example:</p>
  
  <pre><code>@RestController
  @ExposesResourceFor(Thing3.class)
  @RequestMapping("/thing3")
  public class Thing3Controller {
  
    @Autowired 
    EntityLinks entityLinks;
  
    @Autowired 
    Thing3DAO thing3DAO;
  
    //just assume Thing3.class extends ResourceSupport. I know this is wrong, but it makes the example shorter  
    @RequestMapping(value = "/{id}", produces = "application/json")
    Thing3 thing3(@PathVariable("id") String id)
    {
        Thing3 thing3 = thing3DAO.findOne(id);         
  
        Link link = entityLinks.linkToSingleResource(Thing3.class, id);
        thing3.add(link);
  
        return thing3;
    }
  }
  </code></pre>
  
  <p>Now if I run this app and go to:</p>
  
  <pre><code>http://localhost:8080/thing3/{id} 
  </code></pre>
  
  <p>I do get a JSON representation of the Thing3 with a link to itself, that works as expected.</p>
  
  <p>What I want to figure out how to do is have the first endpoint also describe this controller. I basically want this:</p>
  
  <pre><code>{
     _links: {
        thing1: {
           href: "http://localhost:8080/thing1{?page,size,sort}",
           templated: true
        },
        thing2: {
           href: "http://localhost:8080/thing2"
        },
        thing3: {
           href: "http://localhost:8080/thing3"
        }
     }
  }
  </code></pre>
  
  <p>What do I need to do to get my base endpoint to have a link to this controller?</p>