title: How to add custom links to non repository rest controller in spring data rest hal?
body: <p>I would like to add custom rest controller to be added to the json/hal response of the entry point, together with all the respositories that are added by spring. I'm struggling with this by two problems:</p>
  
  <ol>
  <li><p>How can I add my custom controller so it appears on the entry point together with the links to my repository?</p></li>
  <li><p>How can I decorate with a link to my custom controller on a representation of an entity produced by the repository so I can link to my custom controller?</p></li>
  </ol>
  
  <p>I have struggled for a while and created a <a href="https://github.com/niggusch/spring-data-rest-hal-custom" rel="nofollow noreferrer" title="spring-data-rest-hal-custom">github project</a> using spring-data-mongodb to demonstrate what I mean. There is one simple Entity <code>Invoice</code>and the <code>InvoiceRepository</code> which extends MongoRepository and has one special finder Method <code>List&lt;Invoice&gt; findByFirstName(@Param("firstName")String firstName);</code>. 
  In addition there are two custom controller that I would like to be included in the <code>_links</code> section on the entry point of the service-</p>
  
  <p>Using the Hal Browser, the entry point at the moment looks like </p>
  
  <pre><code>{
    "_links": {
      "invoices": {
        "href": "http://localhost:8080/customize/invoices{?page,size,sort}",
        "templated": true
      },
      "profile": {
        "href": "http://localhost:8080/customize/profile"
      }
    }
  }
  </code></pre>
  
  <p>But I would like it to be </p>
  
  <pre><code>  "_links": {
      "invoices": {
        "href": "http://localhost:8080/customize/invoices{?page,size,sort}",
        "templated": true
      },
      "export": {
        "href": "http://localhost:8080/customize/export/invoices"
      },
       "custom":{
        "href": "localhost:8080/customize/invoices/search/customList"
      }   
      "profile": {
        "href": "http://localhost:8080/customize/profile"
      }
    }
  </code></pre>
  
  <p>To the second part of my question, I have no Idea how to achieve.
  The JSON representation of an invoice looks like </p>
  
  <pre><code>{
    "firstName": "Chuck",
    "lastName": "Noris",
    "amount": 2.5,
    "exported": false,
    "_links": {
      "self": {
        "href": "http://localhost:8080/customize/invoices/27490450945023268364302849904"
      },
      "invoice": {
        "href": "http://localhost:8080/customize/invoices/27490450945023268364302849904"
      }
    }
  }
  </code></pre>
  
  <p>I would like to extend it with custom export link to each invoice like this</p>
  
  <pre><code>{
    "firstName": "Chuck",
    "lastName": "Noris",
    "amount": 2.5,
    "exported": false,
    "_links": {
      "self": {
        "href": "http://localhost:8080/customize/invoices/27490450945023268364302849904"
      },
      "invoice": {
        "href": "http://localhost:8080/customize/invoices/27490450945023268364302849904"
      }
      "export": {
        "href": "http://localhost:8080/customize/export/invoice/27490450945023268364302849904"
      }
    }
  }
  </code></pre>