Refactor Gateway clients (#2144)

This commit is contained in:
Grzegorz Piwowarek 2017-06-24 19:44:41 +02:00 committed by GitHub
parent ee2ed99ad9
commit 9e3e240a59
2 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,6 @@ import org.springframework.web.bind.annotation.*;
@FeignClient(value = "book-service") @FeignClient(value = "book-service")
public interface BooksClient { public interface BooksClient {
@RequestMapping(method = RequestMethod.GET, value="/books/{bookId}") @GetMapping("/books/{bookId}")
Book getBookById(@PathVariable("bookId") Long bookId); Book getBookById(@PathVariable("bookId") Long bookId);
} }

View File

@ -1,6 +1,7 @@
package com.baeldung.spring.cloud.bootstrap.gateway.client.rating; package com.baeldung.spring.cloud.bootstrap.gateway.client.rating;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
@ -10,6 +11,6 @@ import java.util.List;
@FeignClient(value = "rating-service") @FeignClient(value = "rating-service")
public interface RatingsClient { public interface RatingsClient {
@RequestMapping(method = RequestMethod.GET, value="/ratings") @GetMapping("/ratings")
List<Rating> getRatingsByBookId(@RequestParam("bookId") Long bookId, @RequestHeader("Cookie") String session); List<Rating> getRatingsByBookId(@RequestParam("bookId") Long bookId, @RequestHeader("Cookie") String session);
} }