Skip to content
Snippets Groups Projects
Commit 03941ece authored by Antoine Rey's avatar Antoine Rey
Browse files

Merge branch 'master' into admin

parents 31cd2628 422bad17
No related branches found
No related tags found
No related merge requests found
......@@ -31,18 +31,6 @@
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Camden.SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
......
......@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.samples.petclinic.customers.model.Owner;
import org.springframework.samples.petclinic.customers.model.OwnerRepository;
import org.springframework.samples.petclinic.monitoring.Monitored;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -53,6 +54,7 @@ class OwnerResource {
*/
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
@Monitored
public void createOwner(@Valid @RequestBody Owner owner) {
ownerRepository.save(owner);
}
......@@ -77,6 +79,7 @@ class OwnerResource {
* Update Owner
*/
@PutMapping(value = "/{ownerId}")
@Monitored
public Owner updateOwner(@PathVariable("ownerId") int ownerId, @Valid @RequestBody Owner ownerRequest) {
final Owner ownerModel = ownerRepository.findOne(ownerId);
// This is done by hand for simplicity purpose. In a real life use-case we should consider using MapStruct.
......
......@@ -26,6 +26,7 @@ import org.springframework.samples.petclinic.customers.model.OwnerRepository;
import org.springframework.samples.petclinic.customers.model.Pet;
import org.springframework.samples.petclinic.customers.model.PetRepository;
import org.springframework.samples.petclinic.customers.model.PetType;
import org.springframework.samples.petclinic.monitoring.Monitored;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -55,6 +56,7 @@ class PetResource {
@PostMapping("/owners/{ownerId}/pets")
@ResponseStatus(HttpStatus.NO_CONTENT)
@Monitored
public void processCreationForm(
@RequestBody PetRequest petRequest,
@PathVariable("ownerId") int ownerId) {
......@@ -68,6 +70,7 @@ class PetResource {
@PutMapping("/owners/*/pets/{petId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
@Monitored
public void processUpdateForm(@RequestBody PetRequest petRequest) {
save(petRepository.findOne(petRequest.getId()), petRequest);
}
......
......@@ -10,24 +10,23 @@
<packaging>jar</packaging>
<description>Spring PetClinic monitoring utilities</description>
<parent>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic-microservices</artifactId>
<version>1.4.2</version>
</parent>
<dependencies>
<!-- Third-parties -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.0</version>
</dependency>
<!-- Spring dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jmx</artifactId>
<scope>provided</scope>
<version>2.0.8</version>
<artifactId>spring-context</artifactId>
</dependency>
<!-- Third-parties -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>provided</scope>
<version>4.3.4.RELEASE</version>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
</dependencies>
</project>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment