TIL : 230119

JINSEON YE·2023년 1월 19일

TIL

목록 보기
58/88

에러메세지:
에러 : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.IllegalStateException: Ambiguous handler methods mapped for '/products/18': {public java.util.List com.dbzz.matchingproject.controller.ProductController.getAllProductByUserId(java.lang.String), public com.dbzz.matchingproject.dto.response.ProductResponseDto com.dbzz.matchingproject.controller.ProductController.getProductByUserId(java.lang.Long,java.lang.String,jakarta.servlet.http.HttpServletRequest)}] with root cause

문제 :
@GetMapping("/products/{productId}")
@GetMapping("/products/{userId}")
이렇게 두 url이 모호해서 변경해줘야한다는 에러.

해결 :
@GetMapping("/myproducts/{productId}")
@GetMapping("/products/{userId}")

or

@GetMapping("/products/{userId}/{productId}")
@GetMapping("/products/{userId}")

profile
백엔드 개발자

0개의 댓글