Skip to content

Commit

Permalink
Merge pull request spring-projects#32 from arey/issues/31
Browse files Browse the repository at this point in the history
Fix spring-projects#31 Services cannot contact with Zipkin server
  • Loading branch information
mszarlinski committed Jan 9, 2017
2 parents 422bad1 + 8b366e7 commit d23ceb1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 39 deletions.
4 changes: 4 additions & 0 deletions spring-petclinic-api-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
</dependency>

<!-- Spring Cloud -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,16 @@
package org.springframework.samples.petclinic.customers.web;

import lombok.RequiredArgsConstructor;

import java.util.List;

import javax.validation.Valid;

import lombok.extern.slf4j.Slf4j;
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;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
* @author Juergen Hoeller
Expand All @@ -45,6 +37,7 @@
@RequestMapping("/owners")
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Slf4j
class OwnerResource {

private final OwnerRepository ownerRepository;
Expand Down Expand Up @@ -88,6 +81,7 @@ public Owner updateOwner(@PathVariable("ownerId") int ownerId, @Valid @RequestBo
ownerModel.setCity(ownerRequest.getCity());
ownerModel.setAddress(ownerRequest.getAddress());
ownerModel.setTelephone(ownerRequest.getTelephone());
log.info("Saving owner {}", ownerModel);
return ownerRepository.save(ownerModel);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,14 @@
package org.springframework.samples.petclinic.customers.web;

import lombok.RequiredArgsConstructor;

import java.util.List;

import lombok.extern.slf4j.Slf4j;
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.customers.model.Pet;
import org.springframework.samples.petclinic.customers.model.PetRepository;
import org.springframework.samples.petclinic.customers.model.PetType;
import org.springframework.samples.petclinic.customers.model.*;
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;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
* @author Juergen Hoeller
Expand All @@ -43,6 +33,7 @@
*/
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Slf4j
class PetResource {

private final PetRepository petRepository;
Expand Down Expand Up @@ -83,6 +74,7 @@ private void save(final Pet pet, final PetRequest petRequest) {
petRepository.findPetTypeById(petRequest.getTypeId())
.ifPresent(pet::setType);

log.info("Saving pet {}", pet);
petRepository.save(pet);
}

Expand Down
4 changes: 4 additions & 0 deletions spring-petclinic-vets-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
</dependency>

<!-- Spring Cloud-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,15 @@
package org.springframework.samples.petclinic.visits.web;

import lombok.RequiredArgsConstructor;

import java.util.List;

import javax.validation.Valid;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.samples.petclinic.visits.model.Visit;
import org.springframework.samples.petclinic.visits.model.VisitRepository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
* @author Juergen Hoeller
Expand All @@ -41,6 +35,7 @@
*/
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Slf4j
public class VisitResource {

private final VisitRepository visitRepository;
Expand All @@ -52,6 +47,7 @@ public void create(
@PathVariable("petId") int petId) {

visit.setPetId(petId);
log.info("Saving visit {}", visit);
visitRepository.save(visit);
}

Expand Down

0 comments on commit d23ceb1

Please sign in to comment.