• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

7장 조회한 빈이 모두 필요할때 list,map 강의 질문드립니다.

23.07.13 16:01 작성 조회수 176

0

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'orderServiceimpl' defined in file [C:\study\core\out\production\classes\hello\core\Order\OrderServiceimpl.class]: Unsatisfied dependency expressed through constructor parameter 1: No qualifying bean of type 'hello.core.discount.DiscountPolicy' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier("mainDiscountPolicy")}

 

라고 뜨고 at hello.core.autowired.AllBeanTest.findAllBean(AllBeanTest.java:21)

여기가 문제라고 하는데 어떻게 해결할 수 있을까요...

ApplicationContext ac = new AnnotationConfigApplicationContext(AutoAppConfig.class, DiscountService.class);

 

위 코드입니다.

답변 1

답변을 작성해보세요.

0

David님의 프로필

David

2023.07.13

안녕하세요. janeholic1773님, 공식 서포터즈 David입니다.

먼저, DiscountPolicy 타입에 주입될 수 있는 빈 또는 mainDiscountPolicy 이름을 가지는 빈을 등록하고 있는지 확인해 보시겠어요?

빈 설정 클래스 또는 DiscountPolicy 타입을 구현하는 구현체를 확인해 주세요.

감사합니다.