강의

멘토링

커뮤니티

Inflearn Community Q&A

17910148420's profile image
17910148420

asked

[Revised 2023-11-27] Developing RESTful Web Services using Spring Boot 3.x

Applying HATEOAS for REST API Implementation at Level 3

헤티오스 빈 문제

Written on

·

629

0

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

 

현재 스프링부트 2.7.9쓰고있고
어떻게 해결해야할까요

rest-apispring-boot

Answer 1

0

Dowon Lee님의 프로필 이미지
Dowon Lee
Instructor

안녕하세요, 이도원입니다.

Spring에서 Context에 등록된 빈들을 매핑하여 사용할 때 동일한 타입의 빈이 여러개 검색될 경우가 있습니다. 이럴 경우, 여러 빈들 사이에서 먼저 매핑될 수 있도록 우선 순위를 높이는 @Primary 방식을 사용하시거나, 빈을 직접 매핑할 때 @Qualifer를 이용하여 직접 빈의 이름이나 타입 등을 지정할 수 있습니다. 해당 오류는 동일한 빈의 타입이 여러개 호출되었기 때문에, 빈의 우선순위나 빈의 타입을 지정해 달라는 의미여서, 빈을 매핑 (@Autowired 등)사용하시는 부분을 다시한번 확인해 보시는게 좋을 듯 합니다.

감사합니다.

17910148420's profile image
17910148420

asked

Ask a question