반응형
@RequestMapping 주석은 @FeignClient 인터페이스에서 허용되지 않습니다.
나 이거 곤란해요!제가 읽어본 바와 같이, 그것은 더 이상 받아들여지지 않기 때문에 일어나는 일입니다.하지만 어떻게 해결할 수 있을까요?이게 제가 지도를 그리려고 했던 코드입니다.
@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);
}
제안이나 해결책을 알려주셔서 미리 감사드립니다!
사용할 수 있습니다.path의 속성.@FeignClient모든 API에 추가할 경로 접두사를 정의합니다.설명서는 여기에 있습니다.
그래서 당신의 Feign 클라이언트 인터페이스는 다음과 같습니다.
@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);
}
언급URL : https://stackoverflow.com/questions/71284214/requestmapping-annotation-not-allowed-on-feignclient-interfaces
반응형
'programing' 카테고리의 다른 글
| PHP에서 종료되지 않은 엔티티 참조 (0) | 2023.07.26 |
|---|---|
| 인덱스가 생성되고 dbms_stats 계산이 사용된 후 쿼리 실행 속도가 느림 (0) | 2023.07.26 |
| Java 스프링:'@Value' 주석을 사용하여 'Environment' 속성을 주입하는 방법은? (0) | 2023.07.26 |
| 텐서플로 보폭 인수 (0) | 2023.07.26 |
| jquery를 사용하여 특정 클래스 이름을 가진 모든 확인란 가져오기 (0) | 2023.07.26 |