[Error] NoUniqueBeanDefinitionException : expected single matching bean but found 2

ohahsis·2024년 2월 5일

Error

스프링 공부를 하던 중 NoUniqueBeanDefinitionException 오류가 터졌다. 자세한 내용은 다음과 같았다.

No qualifying bean of type 'hello.core.member.MemberRepository' available: expected single matching bean but found 2: memoryMemberRepository,memberRepository

MemberRepository 타입의 빈이 memoryMemberRepository, memberRepository 두 개가 존재해서 생긴 오류이다.

Solution

스프링 3 버전 이슈였고, Gradle 을 사용해서 빌드하고 실행해서 해결했다.
Build, Execution, Deployment -> Build Tools -> Gradle 에서 Build and run using 을 Gradle 로 선택하면 된다.

profile
백엔드 개발자입니다.

1개의 댓글

comment-user-thumbnail
2024년 6월 18일

혹시 왜 3버전 때문에 일어나는 문제인지 알수 있을까요?

답글 달기