odrotbohm / rest-microservices

Sample for Spring Boot based REST microservices
194 stars 119 forks source link

TemplateVariables not recognized in "by-location" link #1

Open aheusingfeld opened 10 years ago

aheusingfeld commented 10 years ago

The storesByLocationLink which is defined by the spring-data-rest interface StoreRepository doesn't have any template variables. The JSON of the "rest-microservice-store" looks like this:

$ curl http://localhost:8081/stores/search
{
  "_links" : {
    "by-location" : {
      "href" : "http://localhost:8081/stores/search/findByAddressLocationNear{?location,distance,page,size,sort}",
      "templated" : true
    }
  }
}

As this seems fine to me but the customer JSON looks like this ...

{
  "_embedded": {
    "customers": [
      {
...
        },
        "_links": {
          "self": {
            "href": "http://localhost:8080/customers/1"
          },
          "stores-nearby": {
            "href": "http://localhost:8081/stores/search/findByAddressLocationNear"
          }
        }
      }
    ]
  }
}

... I assume the variables get lost inside the Traverson.

aheusingfeld commented 10 years ago

Actually the cause seems to be that .asLink() only receives the URI without the variables.