I'm having trouble with this! As I've been reading, it happens because it's no longer accepted. But how can I solved it? This is the code I've been trying to map.
@FeignClient(name = "product-service")
@RequestMapping("api/products/")
public interface ProductClient {
@GetMapping("/{id}")
ResponseEntity<Product> getProduct(@PathVariable("id") Long id);
@GetMapping("/{id}/stock")
ResponseEntity<Product> updateStockProduct(@PathVariable("id") Long id,@RequestParam(name = "quantity", required = true) Integer quantity);
}
Thanks in advance for any suggestion or solution!
You can use the path attribute of @FeignClient to define the path prefix to be added to all the APIs. The documentation is here.
So your Feign client interface would look like
@FeignClient(name = "product-service", path = "/api/products")
public interface ProductClient {
@GetMapping("/{id}")
ResponseEntity<Product> getProduct(@PathVariable("id") Long id);
@GetMapping("/{id}/stock")
ResponseEntity<Product> updateStockProduct(@PathVariable("id") Long id,@RequestParam(name = "quantity", required = true) Integer quantity);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With