PathVariable annotation was empty on param 0

zhzkzhffk·2022년 7월 3일
0

spring-error

목록 보기
2/3
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.example.userservice.client.OrderServiceClient': Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException: PathVariable annotation was empty on param 0.

이는 @PathVariable의 문제입니다.

문제의 코드

@FeignClient(name = "order-service")
public interface OrderServiceClient {

    @GetMapping("/order-service/{userId}/orders")
    List<ResponseOrder> getOrders(@PathVariable String userId);
}
@FeignClient(name = "order-service")
public interface OrderServiceClient {

    @GetMapping("/order-service/{userId}/orders")
    List<ResponseOrder> getOrders(@PathVariable("userId") String userId);
}
profile
Backend Developer

0개의 댓글