Skip to content
Snippets Groups Projects
Commit 422bad17 authored by Maciej Szarliński's avatar Maciej Szarliński Committed by GitHub
Browse files

Merge pull request #30 from arey/monitoring

Restore JMX monitoring
parents 8763efba 6dc4b292
No related branches found
No related tags found
No related merge requests found
...@@ -31,18 +31,6 @@ ...@@ -31,18 +31,6 @@
</dependencies> </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> <build>
<plugins> <plugins>
<plugin> <plugin>
......
...@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.samples.petclinic.customers.model.Owner; import org.springframework.samples.petclinic.customers.model.Owner;
import org.springframework.samples.petclinic.customers.model.OwnerRepository; 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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -53,6 +54,7 @@ class OwnerResource { ...@@ -53,6 +54,7 @@ class OwnerResource {
*/ */
@PostMapping @PostMapping
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@Monitored
public void createOwner(@Valid @RequestBody Owner owner) { public void createOwner(@Valid @RequestBody Owner owner) {
ownerRepository.save(owner); ownerRepository.save(owner);
} }
...@@ -77,6 +79,7 @@ class OwnerResource { ...@@ -77,6 +79,7 @@ class OwnerResource {
* Update Owner * Update Owner
*/ */
@PutMapping(value = "/{ownerId}") @PutMapping(value = "/{ownerId}")
@Monitored
public Owner updateOwner(@PathVariable("ownerId") int ownerId, @Valid @RequestBody Owner ownerRequest) { public Owner updateOwner(@PathVariable("ownerId") int ownerId, @Valid @RequestBody Owner ownerRequest) {
final Owner ownerModel = ownerRepository.findOne(ownerId); 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. // 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; ...@@ -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.Pet;
import org.springframework.samples.petclinic.customers.model.PetRepository; import org.springframework.samples.petclinic.customers.model.PetRepository;
import org.springframework.samples.petclinic.customers.model.PetType; 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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -55,6 +56,7 @@ class PetResource { ...@@ -55,6 +56,7 @@ class PetResource {
@PostMapping("/owners/{ownerId}/pets") @PostMapping("/owners/{ownerId}/pets")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
@Monitored
public void processCreationForm( public void processCreationForm(
@RequestBody PetRequest petRequest, @RequestBody PetRequest petRequest,
@PathVariable("ownerId") int ownerId) { @PathVariable("ownerId") int ownerId) {
...@@ -68,6 +70,7 @@ class PetResource { ...@@ -68,6 +70,7 @@ class PetResource {
@PutMapping("/owners/*/pets/{petId}") @PutMapping("/owners/*/pets/{petId}")
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
@Monitored
public void processUpdateForm(@RequestBody PetRequest petRequest) { public void processUpdateForm(@RequestBody PetRequest petRequest) {
save(petRepository.findOne(petRequest.getId()), petRequest); save(petRepository.findOne(petRequest.getId()), petRequest);
} }
......
...@@ -10,24 +10,23 @@ ...@@ -10,24 +10,23 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<description>Spring PetClinic monitoring utilities</description> <description>Spring PetClinic monitoring utilities</description>
<parent>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic-microservices</artifactId>
<version>1.4.2</version>
</parent>
<dependencies> <dependencies>
<!-- Third-parties --> <!-- Spring dependencies -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-jmx</artifactId> <artifactId>spring-context</artifactId>
<scope>provided</scope>
<version>2.0.8</version>
</dependency> </dependency>
<!-- Third-parties -->
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.aspectj</groupId>
<artifactId>spring-context</artifactId> <artifactId>aspectjweaver</artifactId>
<scope>provided</scope>
<version>4.3.4.RELEASE</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </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