본문 바로가기
Spring/TroubleShooting

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name~

by Mecodata 2024. 1. 8.

원인

- Controller에서 API를 정의할 때 서로 메소드 명은 다르지만 같은 HTTP 메소드와 URL을 가지고 있는 API들이 존재했던 것이 원인

해결 방법

- 서로 HTTP 메소드와 URL이 겹쳤던 메소드 중에 하나를 삭제하니 해결됨 

 

Ex

@RestController
@RequestMapping("/api")
public class ShopController { 

    @GetMapping("/a")
    public void buy {
        ....
    }

    @GetMapping("/a")
    public void purchase {
        ....
    }

}

 

 

댓글