Merge branch '1.2.x'
This commit is contained in:
@@ -26,6 +26,7 @@ import org.springframework.hateoas.Resource;
|
||||
import org.springframework.hateoas.Resources;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -47,7 +48,7 @@ public class CustomerController {
|
||||
this.entityLinks = entityLinks;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
HttpEntity<Resources<Customer>> showCustomers() {
|
||||
Resources<Customer> resources = new Resources<Customer>(
|
||||
this.repository.findAll());
|
||||
@@ -55,7 +56,7 @@ public class CustomerController {
|
||||
return new ResponseEntity<Resources<Customer>>(resources, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
HttpEntity<Resource<Customer>> showCustomer(@PathVariable Long id) {
|
||||
Resource<Customer> resource = new Resource<Customer>(this.repository.findOne(id));
|
||||
resource.add(this.entityLinks.linkToSingleResource(Customer.class, id));
|
||||
|
||||
Reference in New Issue
Block a user