diff --git a/README.md b/README.md index e4cb3c3ab..5915bd661 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If everything goes well, you can access the following services at given location * Config Server - http://localhost:8888 * AngularJS frontend (API Gateway) - http://localhost:8080 * Customers, Vets and Visits Services - random port, check Eureka Dashboard -* Tracing Server (Zipkin) - http://localhost:9411 +* Tracing Server (Zipkin) - http://localhost:9411/zipkin/ * Admin Server (Spring Boot Admin) - http://localhost:9090 You can tell Config Server to use your local Git repository by using `local` Spring profile and setting diff --git a/pom.xml b/pom.xml index 397bb32ab..3c9907cc5 100644 --- a/pom.xml +++ b/pom.xml @@ -1,25 +1,26 @@ - - 4.0.0 + + 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 1.5.9.RELEASE - + + org.springframework.boot + spring-boot-starter-parent + 2.0.3.RELEASE + - org.springframework.samples - spring-petclinic-microservices - 1.5.9 + org.springframework.samples + spring-petclinic-microservices + 2.0.3 ${project.artifactId} - pom + pom - - spring-petclinic-admin-server - spring-petclinic-customers-service - spring-petclinic-vets-service - spring-petclinic-visits-service - spring-petclinic-config-server + + spring-petclinic-admin-server + spring-petclinic-customers-service + spring-petclinic-vets-service + spring-petclinic-visits-service + spring-petclinic-config-server spring-petclinic-discovery-server spring-petclinic-api-gateway spring-petclinic-monitoring @@ -28,32 +29,32 @@ 3.9.0 - Edgware.SR1 - 1.3.1.RELEASE + Finchley.RELEASE + 2.0.0.RC2 1.8 - mszarlinski + mszarlinski 9090 ${basedir} - 0.4.13 + 0.4.13 - - + + org.springframework.cloud spring-cloud-sleuth-dependencies - pom - import + pom + import ${sleuth.version} - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + org.springframework.samples.petclinic.monitoring @@ -66,8 +67,8 @@ ${assertj.version} test - - + + @@ -167,4 +168,12 @@ + + + repository.spring.milestone + Spring Milestone Repository + http://repo.spring.io/milestone + + + diff --git a/spring-petclinic-admin-server/pom.xml b/spring-petclinic-admin-server/pom.xml index e73946fdd..8812b82e9 100644 --- a/spring-petclinic-admin-server/pom.xml +++ b/spring-petclinic-admin-server/pom.xml @@ -12,11 +12,11 @@ org.springframework.samples spring-petclinic-microservices - 1.5.9 + 2.0.3 - 1.5.6 + 2.0.1 9090 ${basedir}/../docker @@ -39,7 +39,7 @@ de.codecentric - spring-boot-admin-server + spring-boot-admin-starter-server ${spring-boot-admin.version} diff --git a/spring-petclinic-admin-server/src/main/java/org/springframework/samples/petclinic/admin/SpringBootAdminApplication.java b/spring-petclinic-admin-server/src/main/java/org/springframework/samples/petclinic/admin/SpringBootAdminApplication.java index 97f85e85f..eb9349cd7 100644 --- a/spring-petclinic-admin-server/src/main/java/org/springframework/samples/petclinic/admin/SpringBootAdminApplication.java +++ b/spring-petclinic-admin-server/src/main/java/org/springframework/samples/petclinic/admin/SpringBootAdminApplication.java @@ -15,7 +15,7 @@ */ package org.springframework.samples.petclinic.admin; -import de.codecentric.boot.admin.config.EnableAdminServer; +import de.codecentric.boot.admin.server.config.EnableAdminServer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @@ -29,4 +29,5 @@ public class SpringBootAdminApplication { public static void main(String[] args) { SpringApplication.run(SpringBootAdminApplication.class, args); } + } diff --git a/spring-petclinic-api-gateway/pom.xml b/spring-petclinic-api-gateway/pom.xml index b7524d045..e47d85b51 100644 --- a/spring-petclinic-api-gateway/pom.xml +++ b/spring-petclinic-api-gateway/pom.xml @@ -11,7 +11,7 @@ org.springframework.samples spring-petclinic-microservices - 1.5.9 + 2.0.3 @@ -106,7 +106,7 @@ org.webjars - webjars-locator + webjars-locator-core diff --git a/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/OwnerDetails.java b/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/OwnerDetails.java index cc6a7b523..ca2be1cdc 100644 --- a/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/OwnerDetails.java +++ b/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/OwnerDetails.java @@ -17,6 +17,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; +import lombok.NoArgsConstructor; import java.util.ArrayList; import java.util.List; @@ -29,17 +30,17 @@ @Data public class OwnerDetails { - private final int id; + private int id; - private final String firstName; + private String firstName; - private final String lastName; + private String lastName; - private final String address; + private String address; - private final String city; + private String city; - private final String telephone; + private String telephone; private final List pets = new ArrayList<>(); diff --git a/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/PetDetails.java b/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/PetDetails.java index 74a3f2012..b2b40d0e4 100644 --- a/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/PetDetails.java +++ b/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/PetDetails.java @@ -16,6 +16,7 @@ package org.springframework.samples.petclinic.api.application; import lombok.Data; +import lombok.NoArgsConstructor; import java.util.ArrayList; import java.util.List; @@ -26,13 +27,13 @@ @Data public class PetDetails { - private final int id; + private int id; - private final String name; + private String name; - private final String birthDate; + private String birthDate; - private final PetType type; + private PetType type; private final List visits = new ArrayList<>(); diff --git a/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/PetType.java b/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/PetType.java index 10b6fc2cd..bd284b558 100644 --- a/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/PetType.java +++ b/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/PetType.java @@ -16,6 +16,7 @@ package org.springframework.samples.petclinic.api.application; import lombok.Data; +import lombok.NoArgsConstructor; /** * @author Maciej Szarlinski @@ -23,5 +24,5 @@ @Data public class PetType { - private final String name; + private String name; } diff --git a/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/VisitDetails.java b/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/VisitDetails.java index 99769b0c5..beefaa3fb 100644 --- a/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/VisitDetails.java +++ b/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/application/VisitDetails.java @@ -16,6 +16,7 @@ package org.springframework.samples.petclinic.api.application; import lombok.Data; +import lombok.NoArgsConstructor; /** * @author Maciej Szarlinski @@ -23,11 +24,11 @@ @Data public class VisitDetails { - private final int id; + private int id; - private final int petId; + private int petId; - private final String date; + private String date; - private final String description; + private String description; } diff --git a/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/infrastructure/config/WebConfig.java b/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/infrastructure/config/WebConfig.java deleted file mode 100644 index 1b14759e7..000000000 --- a/spring-petclinic-api-gateway/src/main/java/org/springframework/samples/petclinic/api/infrastructure/config/WebConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2002-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.samples.petclinic.api.infrastructure.config; - -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; - -@Configuration -public class WebConfig extends WebMvcConfigurerAdapter { - - @Override - public void addViewControllers(ViewControllerRegistry registry) { - registry.addViewController("/").setViewName("index"); - } -} diff --git a/spring-petclinic-config-server/pom.xml b/spring-petclinic-config-server/pom.xml index c2c3fc537..752cfa299 100644 --- a/spring-petclinic-config-server/pom.xml +++ b/spring-petclinic-config-server/pom.xml @@ -11,7 +11,7 @@ org.springframework.samples spring-petclinic-microservices - 1.5.9 + 2.0.3 diff --git a/spring-petclinic-customers-service/pom.xml b/spring-petclinic-customers-service/pom.xml index 98dee2852..7dc6fd570 100644 --- a/spring-petclinic-customers-service/pom.xml +++ b/spring-petclinic-customers-service/pom.xml @@ -11,7 +11,7 @@ org.springframework.samples spring-petclinic-microservices - 1.5.9 + 2.0.3 @@ -52,7 +52,7 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-netflix-eureka-client org.springframework.cloud diff --git a/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/Owner.java b/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/Owner.java index bacbf191d..360e7652f 100644 --- a/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/Owner.java +++ b/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/Owner.java @@ -31,8 +31,8 @@ import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.Digits; +import javax.validation.constraints.NotEmpty; -import org.hibernate.validator.constraints.NotEmpty; import org.springframework.beans.support.MutableSortDefinition; import org.springframework.beans.support.PropertyComparator; import org.springframework.core.style.ToStringCreator; diff --git a/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/Pet.java b/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/Pet.java index 25ae2d5c0..e0d28a9fd 100644 --- a/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/Pet.java +++ b/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/model/Pet.java @@ -29,6 +29,7 @@ import javax.persistence.TemporalType; import com.fasterxml.jackson.annotation.JsonIgnore; +import org.springframework.core.style.ToStringCreator; /** * Simple business object representing a pet. @@ -100,4 +101,17 @@ public Owner getOwner() { public void setOwner(final Owner owner) { this.owner = owner; } + + @Override + public String toString() { + return new ToStringCreator(this) + .append("id", this.getId()) + .append("name", this.getName()) + .append("birthDate", this.getBirthDate()) + .append("type", this.getType().getName()) + .append("ownerFirstname", this.getOwner().getFirstName()) + .append("ownerLastname", this.getOwner().getLastName()) + .toString(); + } + } diff --git a/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/OwnerResource.java b/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/OwnerResource.java index 802c73d9b..4cdac535e 100644 --- a/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/OwnerResource.java +++ b/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/OwnerResource.java @@ -26,6 +26,7 @@ import javax.validation.Valid; import java.util.List; +import java.util.Optional; /** * @author Juergen Hoeller @@ -56,8 +57,8 @@ public void createOwner(@Valid @RequestBody Owner owner) { * Read single Owner */ @GetMapping(value = "/{ownerId}") - public Owner findOwner(@PathVariable("ownerId") int ownerId) { - return ownerRepository.findOne(ownerId); + public Optional findOwner(@PathVariable("ownerId") int ownerId) { + return ownerRepository.findById(ownerId); } /** @@ -74,7 +75,9 @@ public List findAll() { @PutMapping(value = "/{ownerId}") @Monitored public Owner updateOwner(@PathVariable("ownerId") int ownerId, @Valid @RequestBody Owner ownerRequest) { - final Owner ownerModel = ownerRepository.findOne(ownerId); + final Optional owner = ownerRepository.findById(ownerId); + + final Owner ownerModel = owner.orElseThrow(() -> new ResourceNotFoundException("Owner "+ownerId+" not found")); // This is done by hand for simplicity purpose. In a real life use-case we should consider using MapStruct. ownerModel.setFirstName(ownerRequest.getFirstName()); ownerModel.setLastName(ownerRequest.getLastName()); diff --git a/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/PetResource.java b/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/PetResource.java index a7c7d3032..e196ca882 100644 --- a/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/PetResource.java +++ b/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/PetResource.java @@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Optional; /** * @author Juergen Hoeller @@ -53,7 +54,8 @@ public void processCreationForm( @PathVariable("ownerId") int ownerId) { final Pet pet = new Pet(); - final Owner owner = ownerRepository.findOne(ownerId); + final Optional optionalOwner = ownerRepository.findById(ownerId); + Owner owner = optionalOwner.orElseThrow(() -> new ResourceNotFoundException("Owner "+ownerId+" not found")); owner.addPet(pet); save(pet, petRequest); @@ -63,7 +65,9 @@ public void processCreationForm( @ResponseStatus(HttpStatus.NO_CONTENT) @Monitored public void processUpdateForm(@RequestBody PetRequest petRequest) { - save(petRepository.findOne(petRequest.getId()), petRequest); + int petId = petRequest.getId(); + Pet pet = findPetById(petId); + save(pet, petRequest); } private void save(final Pet pet, final PetRequest petRequest) { @@ -80,7 +84,16 @@ private void save(final Pet pet, final PetRequest petRequest) { @GetMapping("owners/*/pets/{petId}") public PetDetails findPet(@PathVariable("petId") int petId) { - return new PetDetails(petRepository.findOne(petId)); + return new PetDetails(findPetById(petId)); + } + + + private Pet findPetById(int petId) { + Optional pet = petRepository.findById(petId); + if (!pet.isPresent()) { + throw new ResourceNotFoundException("Pet "+petId+" not found"); + } + return pet.get(); } } diff --git a/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/ResourceNotFoundException.java b/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/ResourceNotFoundException.java new file mode 100644 index 000000000..c321a99d0 --- /dev/null +++ b/spring-petclinic-customers-service/src/main/java/org/springframework/samples/petclinic/customers/web/ResourceNotFoundException.java @@ -0,0 +1,13 @@ +package org.springframework.samples.petclinic.customers.web; + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ResponseStatus; + +@ResponseStatus(value = HttpStatus.NOT_FOUND) +public class ResourceNotFoundException extends RuntimeException { + + public ResourceNotFoundException(String message) { + super(message); + } + +} diff --git a/spring-petclinic-customers-service/src/test/java/org/springframework/samples/petclinic/customers/web/PetResourceDatabaseTest.java b/spring-petclinic-customers-service/src/test/java/org/springframework/samples/petclinic/customers/web/PetResourceDatabaseTest.java index cf7b5ab72..376904d48 100644 --- a/spring-petclinic-customers-service/src/test/java/org/springframework/samples/petclinic/customers/web/PetResourceDatabaseTest.java +++ b/spring-petclinic-customers-service/src/test/java/org/springframework/samples/petclinic/customers/web/PetResourceDatabaseTest.java @@ -39,7 +39,7 @@ public class PetResourceDatabaseTest { @Test public void shouldGetAPet() throws Exception { - Pet pet = petRepository.findOne(2); + Pet pet = petRepository.findById(2).get(); assertThat(petRepository.findAll()).contains(pet); } } diff --git a/spring-petclinic-customers-service/src/test/java/org/springframework/samples/petclinic/customers/web/PetResourceTest.java b/spring-petclinic-customers-service/src/test/java/org/springframework/samples/petclinic/customers/web/PetResourceTest.java index 7f152a673..91ab77496 100644 --- a/spring-petclinic-customers-service/src/test/java/org/springframework/samples/petclinic/customers/web/PetResourceTest.java +++ b/spring-petclinic-customers-service/src/test/java/org/springframework/samples/petclinic/customers/web/PetResourceTest.java @@ -21,6 +21,8 @@ import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; +import java.util.Optional; + /** * @author Maciej Szarlinski */ @@ -43,10 +45,10 @@ public void shouldGetAPetInJSonFormat() throws Exception { Pet pet = setupPet(); - given(petRepository.findOne(2)).willReturn(pet); + given(petRepository.findById(2)).willReturn(Optional.of(pet)); - mvc.perform(get("/owners/2/pets/2.json").accept(MediaType.APPLICATION_JSON)) + mvc.perform(get("/owners/2/pets/2").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().contentType("application/json;charset=UTF-8")) .andExpect(jsonPath("$.id").value(2)) diff --git a/spring-petclinic-discovery-server/pom.xml b/spring-petclinic-discovery-server/pom.xml index ea0c04f86..dde7ff5f3 100644 --- a/spring-petclinic-discovery-server/pom.xml +++ b/spring-petclinic-discovery-server/pom.xml @@ -11,7 +11,7 @@ org.springframework.samples spring-petclinic-microservices - 1.5.9 + 2.0.3 diff --git a/spring-petclinic-monitoring/pom.xml b/spring-petclinic-monitoring/pom.xml index 5f059d6a5..639e960d9 100644 --- a/spring-petclinic-monitoring/pom.xml +++ b/spring-petclinic-monitoring/pom.xml @@ -12,7 +12,7 @@ org.springframework.samples spring-petclinic-microservices - 1.5.9 + 2.0.3 diff --git a/spring-petclinic-tracing-server/pom.xml b/spring-petclinic-tracing-server/pom.xml index df1cb6f05..832de6c70 100644 --- a/spring-petclinic-tracing-server/pom.xml +++ b/spring-petclinic-tracing-server/pom.xml @@ -12,10 +12,11 @@ org.springframework.samples spring-petclinic-microservices - 1.5.9 + 2.0.3 + 2.8.4 8081 ${basedir}/../docker @@ -46,10 +47,12 @@ io.zipkin.java zipkin-server + ${zipkin.version} io.zipkin.java zipkin-autoconfigure-ui + ${zipkin.version} runtime diff --git a/spring-petclinic-vets-service/pom.xml b/spring-petclinic-vets-service/pom.xml index c2ea35252..d42a9f3e0 100644 --- a/spring-petclinic-vets-service/pom.xml +++ b/spring-petclinic-vets-service/pom.xml @@ -11,7 +11,7 @@ org.springframework.samples spring-petclinic-microservices - 1.5.9 + 2.0.3 @@ -59,7 +59,7 @@ org.springframework.cloud - spring-cloud-starter-eureka + spring-cloud-starter-netflix-eureka-client org.springframework.cloud diff --git a/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/model/Vet.java b/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/model/Vet.java index 1a9ace294..cddb6a9e3 100644 --- a/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/model/Vet.java +++ b/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/model/Vet.java @@ -31,9 +31,9 @@ import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; +import javax.validation.constraints.NotEmpty; import javax.xml.bind.annotation.XmlElement; -import org.hibernate.validator.constraints.NotEmpty; import org.springframework.beans.support.MutableSortDefinition; import org.springframework.beans.support.PropertyComparator; diff --git a/spring-petclinic-vets-service/src/test/java/org/springframework/samples/petclinic/vets/web/VetResourceDatabaseTest.java b/spring-petclinic-vets-service/src/test/java/org/springframework/samples/petclinic/vets/web/VetResourceDatabaseTest.java index 6cca60940..5f1387ae6 100644 --- a/spring-petclinic-vets-service/src/test/java/org/springframework/samples/petclinic/vets/web/VetResourceDatabaseTest.java +++ b/spring-petclinic-vets-service/src/test/java/org/springframework/samples/petclinic/vets/web/VetResourceDatabaseTest.java @@ -41,7 +41,7 @@ public class VetResourceDatabaseTest { @Test public void shouldGetAListOfVetsInJSonFormat() throws Exception { - Vet vet = vetRepository.findOne(1); + Vet vet = vetRepository.findById(1).get(); assertThat(vetRepository.findAll()).contains(vet); } } diff --git a/spring-petclinic-vets-service/src/test/java/org/springframework/samples/petclinic/vets/web/VetResourceTest.java b/spring-petclinic-vets-service/src/test/java/org/springframework/samples/petclinic/vets/web/VetResourceTest.java index 78890eebb..a2a5b77fd 100644 --- a/spring-petclinic-vets-service/src/test/java/org/springframework/samples/petclinic/vets/web/VetResourceTest.java +++ b/spring-petclinic-vets-service/src/test/java/org/springframework/samples/petclinic/vets/web/VetResourceTest.java @@ -55,7 +55,7 @@ public void shouldGetAListOfVetsInJSonFormat() throws Exception { given(vetRepository.findAll()).willReturn(asList(vet)); - mvc.perform(get("/vets.json").accept(MediaType.APPLICATION_JSON)) + mvc.perform(get("/vets").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$[0].id").value(1)); } diff --git a/spring-petclinic-visits-service/pom.xml b/spring-petclinic-visits-service/pom.xml index 2e44cadf5..2d282582b 100644 --- a/spring-petclinic-visits-service/pom.xml +++ b/spring-petclinic-visits-service/pom.xml @@ -11,7 +11,7 @@ org.springframework.samples spring-petclinic-microservices - 1.5.9 + 2.0.3 diff --git a/spring-petclinic-visits-service/src/test/java/org/springframework/samples/petclinic/visits/VisitResourceDatabaseTest.java b/spring-petclinic-visits-service/src/test/java/org/springframework/samples/petclinic/visits/VisitResourceDatabaseTest.java index b5ea583fa..087d8f757 100644 --- a/spring-petclinic-visits-service/src/test/java/org/springframework/samples/petclinic/visits/VisitResourceDatabaseTest.java +++ b/spring-petclinic-visits-service/src/test/java/org/springframework/samples/petclinic/visits/VisitResourceDatabaseTest.java @@ -40,7 +40,7 @@ public class VisitResourceDatabaseTest { @Test public void shouldGetAListOfVetsInJSonFormat() throws Exception { - Visit vet = visitRepository.findOne(1); + Visit vet = visitRepository.findById(1).get(); assertThat(visitRepository.findAll()).contains(vet); } }