Commit 6e189900 authored by dreis2211's avatar dreis2211 Committed by Stephane Nicoll

Fix deprecations in spring-boot-smoke-test-hateoas

See gh-19711
parent aae1151f
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2020 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -48,14 +48,14 @@ public class CustomerController { ...@@ -48,14 +48,14 @@ public class CustomerController {
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
HttpEntity<CollectionModel<Customer>> showCustomers() { HttpEntity<CollectionModel<Customer>> showCustomers() {
CollectionModel<Customer> resources = new CollectionModel<>(this.repository.findAll()); CollectionModel<Customer> resources = CollectionModel.of(this.repository.findAll());
resources.add(this.entityLinks.linkToCollectionResource(Customer.class)); resources.add(this.entityLinks.linkToCollectionResource(Customer.class));
return new ResponseEntity<>(resources, HttpStatus.OK); return new ResponseEntity<>(resources, HttpStatus.OK);
} }
@GetMapping(path = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(path = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
HttpEntity<EntityModel<Customer>> showCustomer(@PathVariable Long id) { HttpEntity<EntityModel<Customer>> showCustomer(@PathVariable Long id) {
EntityModel<Customer> resource = new EntityModel<>(this.repository.findOne(id)); EntityModel<Customer> resource = EntityModel.of(this.repository.findOne(id));
resource.add(this.entityLinks.linkToItemResource(Customer.class, id)); resource.add(this.entityLinks.linkToItemResource(Customer.class, id));
return new ResponseEntity<>(resource, HttpStatus.OK); return new ResponseEntity<>(resource, HttpStatus.OK);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment